Fixed on disable error message spam.

Changed `sound` command to `add sound`.
This commit is contained in:
Mateus 2019-02-19 02:22:20 +00:00
parent 094e7c2cd0
commit f7c9933b02
3 changed files with 17 additions and 18 deletions

View File

@ -68,7 +68,10 @@ public final class CitizensCMD extends JavaPlugin {
public void onEnable() {
if (!hasCitizens()) Util.disablePlugin(this);
if (!hasCitizens()) {
Util.disablePlugin(this);
return;
}
commandHandler = new CommandHandler(this);
commandHandler.enable();
@ -121,22 +124,22 @@ public final class CitizensCMD extends JavaPlugin {
if (setupEconomy()) {
switch (lang.getLanguage()) {
case "en":
info(color(TAG + "&7Using &aVult&7!"));
info(color(TAG + "&7Using &aVault&7!"));
break;
case "pt":
info(color(TAG + "&7Usando &aVult&7!"));
info(color(TAG + "&7Usando &aVault&7!"));
break;
case "ro":
info(color(TAG + "&7Folositi &aVult&7!"));
info(color(TAG + "&7Folositi &aVault&7!"));
break;
case "bg":
info(color(TAG + "&7Използвайки &aVult&7!"));
info(color(TAG + "&7Използвайки &aVault&7!"));
break;
case "no":
info(color(TAG + "&7Bruk &aVult&7!"));
info(color(TAG + "&7Bruk &aVault&7!"));
break;
case "ch":
info(color(TAG + "&7运用 &aVult&7!"));
info(color(TAG + "&7运用 &aVault&7!"));
break;
}
}
@ -202,8 +205,10 @@ public final class CitizensCMD extends JavaPlugin {
@Override
public void onDisable() {
commandHandler.disable();
cooldownHandler.saveToFile();
if (commandHandler != null) {
commandHandler.disable();
cooldownHandler.saveToFile();
}
}
private boolean hasCitizens() {

View File

@ -157,6 +157,7 @@ public class CommandHandler implements CommandExecutor, TabCompleter, IHandler {
switch (subCMD) {
case "add":
if (args.length == 2) return getCommandNames(subCMD, args, 1, (Player) sender);
if (args.length == 3) return getCommandNames(subCMD, args, 2, (Player) sender);
break;
case "remove":
@ -185,10 +186,6 @@ public class CommandHandler implements CommandExecutor, TabCompleter, IHandler {
return getCommandNames(subCMD, args, 5, (Player) sender);
}
break;
case "sound":
if (args.length == 2) return getCommandNames(subCMD, args, 1, (Player) sender);
break;
}
}

View File

@ -160,7 +160,8 @@ public class Util {
switch (subCMD.toLowerCase()) {
case "add":
argComplete[0] = new String[]{"console", "none", "permission", "server", "message"};
argComplete[0] = new String[]{"console", "none", "permission", "server", "message", "sound"};
argComplete[1] = getSoundsList();
break;
case "remove":
argComplete[0] = new String[]{"left", "right"};
@ -174,10 +175,6 @@ public class Util {
argComplete[3] = plugin.getDataHandler().getCompleteCommandsNumbers(getSelectedNpcId(player), EnumTypes.ClickType.RIGHT);
argComplete[4] = new String[]{"console", "none", "permission", "server", "message"};
break;
case "sound":
argComplete[0] = getSoundsList();
break;
}
return argComplete;
}