Fix - Linking commands are now always added
parent
b95275bfec
commit
63bca4d64a
|
@ -35,11 +35,8 @@ public class CommandDiscord extends CommandTreeBase {
|
|||
this.addSubcommand(new SubCommandTps());
|
||||
this.addSubcommand(new SubCommandUnstuck());
|
||||
this.addSubcommand(new SubCommandUptime());
|
||||
|
||||
if (Configuration.getConfig().discord.allowLinking) {
|
||||
this.addSubcommand(new SubCommandLink());
|
||||
this.addSubcommand(new SubCommandUnlink());
|
||||
}
|
||||
this.addSubcommand(new SubCommandLink());
|
||||
this.addSubcommand(new SubCommandUnlink());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,16 +49,6 @@ public class CommandDiscord extends CommandTreeBase {
|
|||
return "/discord <config|online" + (Configuration.getConfig().discord.allowLinking ? "|link|unlink" : "") + "|tps|unstuck|uptime> [options]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAliases() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
|
||||
return sender.canUseCommand(4, getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsernameIndex(String[] args, int index) {
|
||||
return args.length > 1 && args[0].equalsIgnoreCase("unstuck") && index == 1;
|
||||
|
|
|
@ -46,6 +46,11 @@ class SubCommandLink extends CommandBase {
|
|||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] strings) throws CommandException {
|
||||
if (!Configuration.getConfig().discord.allowLinking) {
|
||||
sender.sendMessage(new TextComponentString(MinecraftFormattingCodes.DARK_RED + "Linking is disabled on this server."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof EntityPlayer)) {
|
||||
sender.sendMessage(new TextComponentString(MinecraftFormattingCodes.DARK_RED + "You need to be a player"));
|
||||
return;
|
||||
|
|
|
@ -42,6 +42,11 @@ class SubCommandUnlink extends CommandBase {
|
|||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] strings) throws CommandException {
|
||||
if (!Configuration.getConfig().discord.allowLinking) {
|
||||
sender.sendMessage(new TextComponentString(MinecraftFormattingCodes.DARK_RED + "Linking is disabled on this server."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof EntityPlayer)) {
|
||||
sender.sendMessage(new TextComponentString(MinecraftFormattingCodes.DARK_RED + "You need to be a player"));
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue