diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-15 02:26:41 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-15 02:26:41 +0000 |
commit | f25a5ea2e8bf0aea480fe3bf3b33f53b073e2d96 (patch) | |
tree | 7501a7ab6fe3ab02a016c24f8e1360269a5b9789 /src/Java/gtPlusPlus/core/commands | |
parent | 1aa5ac9a87993829353a3ee7c62a48b398b03257 (diff) | |
download | GT5-Unofficial-f25a5ea2e8bf0aea480fe3bf3b33f53b073e2d96.tar.gz GT5-Unofficial-f25a5ea2e8bf0aea480fe3bf3b33f53b073e2d96.tar.bz2 GT5-Unofficial-f25a5ea2e8bf0aea480fe3bf3b33f53b073e2d96.zip |
% Adjusted the '/gtpp' command.
$ Hopefully fixed quirky OreDict behaviour for custom Logs, Saplings and Leaves.
Diffstat (limited to 'src/Java/gtPlusPlus/core/commands')
-rw-r--r-- | src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 5b9c17bacf..06b6f14822 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -20,92 +20,92 @@ public class CommandEnableDebugWhileRunning implements ICommand public CommandEnableDebugWhileRunning(){ this.aliases = new ArrayList<>(); + this.aliases.add("gtplusplus"); } @Override public int compareTo(final Object o){ - return 0; - + if (o instanceof Comparable<?>) { + @SuppressWarnings("unchecked") + Comparable<ICommand> a = (Comparable<ICommand>) o; + if (a.equals(this)) { + return 0; + } + else { + return -1; + } + } + return -1; } @Override public String getCommandName(){ - return "debugmodegtpp"; + return "gtpp"; } - - // Use '/debugmodegtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. + + // Use '/gtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. // Using nothing after the command toggles both to their opposite states respectively. @Override public String getCommandUsage(final ICommandSender var1){ - return "/debugmodegtpp"; - + return "/gtpp ?"; } @Override public List<String> getCommandAliases(){ return this.aliases; - } @Override public void processCommand(final ICommandSender S, final String[] argString){ - - if (argString == null || argString.length == 0 || argString.length > 1) { - Logger.INFO("Toggling Debug Mode & Logging."); + int aMaxArgumentsAllowed = 1; + + if ((argString == null || argString.length == 0 || argString.length > aMaxArgumentsAllowed) || argString[0].toLowerCase().equals("?")) { + Logger.INFO("Listing commands and their uses."); + final EntityPlayer P = CommandUtils.getPlayer(S); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "The following are valid args for the '/gtpp' command:"); + PlayerUtils.messagePlayer(P, "? - This help command."); + PlayerUtils.messagePlayer(P, "logging - Toggles ALL GT++ logging for current session."); + PlayerUtils.messagePlayer(P, "debug - Toggles GT++ Debug Mode. Only use when advised, may break everything. (OP)"); + } + else if (argString[0].toLowerCase().equals("debug")) { + Logger.INFO("Toggling Debug Mode."); final EntityPlayer P = CommandUtils.getPlayer(S); if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); - } - } - else { - if (argString[0].toLowerCase().equals("debug")) { - Logger.INFO("Toggling Debug Mode."); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); - } - } - else if (argString[0].toLowerCase().equals("logging")) { - Logger.INFO("Toggling Logging."); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); - } - } - else { - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - PlayerUtils.messagePlayer(P, "Invalid command, use 'debug' or 'logging'"); - } + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); } } - - - + else if (argString[0].toLowerCase().equals("logging")) { + Logger.INFO("Toggling Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + else { + final EntityPlayer P = CommandUtils.getPlayer(S); + PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); + } + } @Override public boolean canCommandSenderUseCommand(final ICommandSender var1){ - if (var1 == null) { - return false; - } - final EntityPlayer P = CommandUtils.getPlayer(var1); - if (P != null && PlayerUtils.isPlayerOP(P)) { - return true; + if (var1 == null || CommandUtils.getPlayer(var1) == null) { + return false; } - return false; + return true; } @Override public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){ - return null; + ArrayList<String> aTabCompletes = new ArrayList<String>(); + aTabCompletes.add("?"); + aTabCompletes.add("logging"); + aTabCompletes.add("debug"); + return aTabCompletes; } @Override @@ -115,7 +115,7 @@ public class CommandEnableDebugWhileRunning implements ICommand } public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ - return true; + return true; } }
\ No newline at end of file |