Fixed command recognition

This commit is contained in:
Fuzzlemann 2017-07-26 12:56:01 +02:00
parent 047446bcd6
commit 322b81a28d
4 changed files with 10 additions and 8 deletions

View File

@ -132,7 +132,7 @@ public class AnalyzeCommand extends SubCommand {
sendLink(sender, url); sendLink(sender, url);
} }
} }
sender.sendMessage(Phrase.CMD_FOOTER + ""); sender.sendMessage(Phrase.CMD_FOOTER.toString());
} }
@Deprecated // TODO Will be rewritten to the RslPlugin abstractions in the future. @Deprecated // TODO Will be rewritten to the RslPlugin abstractions in the future.

View File

@ -23,7 +23,7 @@ public class ReloadCommand extends SubCommand {
* @param plugin Current instance of Plan * @param plugin Current instance of Plan
*/ */
public ReloadCommand(Plan plugin) { public ReloadCommand(Plan plugin) {
super("reload", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_RELOAD + ""); super("reload", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_RELOAD.toString());
this.plugin = plugin; this.plugin = plugin;
} }
@ -33,7 +33,7 @@ public class ReloadCommand extends SubCommand {
plugin.onDisable(); plugin.onDisable();
plugin.reloadConfig(); plugin.reloadConfig();
plugin.onEnable(); plugin.onEnable();
sender.sendMessage(Phrase.RELOAD_COMPLETE + ""); sender.sendMessage(Phrase.RELOAD_COMPLETE.toString());
return true; return true;
} }

View File

@ -5,14 +5,15 @@ import com.djrapitops.plugin.command.ISender;
import com.djrapitops.plugin.command.SubCommand; import com.djrapitops.plugin.command.SubCommand;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.utilities.FormattingUtils; import com.djrapitops.plugin.utilities.FormattingUtils;
import java.util.Arrays;
import java.util.List;
import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Permissions;
import main.java.com.djrapitops.plan.Phrase; import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.utilities.Check; import main.java.com.djrapitops.plan.utilities.Check;
import main.java.com.djrapitops.plan.utilities.MiscUtils; import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.util.Arrays;
import java.util.List;
/** /**
* This subcommand is used to search for a user, and to view all matches' data. * This subcommand is used to search for a user, and to view all matches' data.
* *
@ -57,7 +58,7 @@ public class SearchCommand extends SubCommand {
} else { } else {
sender.sendMessage(Phrase.CMD_MATCH + "" + FormattingUtils.collectionToStringNoBrackets(names)); sender.sendMessage(Phrase.CMD_MATCH + "" + FormattingUtils.collectionToStringNoBrackets(names));
} }
sender.sendMessage(Phrase.CMD_FOOTER + ""); sender.sendMessage(Phrase.CMD_FOOTER.toString());
} finally { } finally {
this.cancel(); this.cancel();
} }

View File

@ -49,14 +49,14 @@ public class PlanCommandPreprocessListener implements Listener {
boolean combineCommandAliasesToMainCommand = Settings.COMBINE_COMMAND_ALIASES_TO_MAIN_COMMAND.isTrue(); boolean combineCommandAliasesToMainCommand = Settings.COMBINE_COMMAND_ALIASES_TO_MAIN_COMMAND.isTrue();
if (doNotLogUnknownCommands || combineCommandAliasesToMainCommand) { if (doNotLogUnknownCommands || combineCommandAliasesToMainCommand) {
Command command = plugin.getServer().getPluginCommand(commandName); Command command = plugin.getServer().getPluginCommand(commandName.substring(1, commandName.length()));
if (command == null) { if (command == null) {
if (doNotLogUnknownCommands) { if (doNotLogUnknownCommands) {
Log.debug("Ignored command, command is unknown"); Log.debug("Ignored command, command is unknown");
return; return;
} }
} else if (combineCommandAliasesToMainCommand) { } else if (combineCommandAliasesToMainCommand) {
commandName = command.getName(); commandName = "/" + command.getName();
} }
} }
@ -66,6 +66,7 @@ public class PlanCommandPreprocessListener implements Listener {
Log.debug("Ignored command, player had ignore permission."); Log.debug("Ignored command, player had ignore permission.");
return; return;
} }
handler.handleCommand(commandName); handler.handleCommand(commandName);
} }
} }