mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-02 20:51:26 +01:00
Better command exception handling. Fallback to ConsoleSender for vanilla commands.
This commit is contained in:
parent
809cdf4ba3
commit
6a698bd542
@ -55,12 +55,27 @@ public class CommandQueueWatcher {
|
|||||||
if (ircCommand != null) {
|
if (ircCommand != null) {
|
||||||
try {
|
try {
|
||||||
String cmd = ircCommand.getGameCommand().split(" ")[0];
|
String cmd = ircCommand.getGameCommand().split(" ")[0];
|
||||||
boolean isCommandBookCommand = false;
|
|
||||||
plugin.logDebug("CMD: " + cmd);
|
plugin.logDebug("CMD: " + cmd);
|
||||||
|
/*
|
||||||
|
boolean isCommandBookCommand = false;
|
||||||
if (plugin.commandBookHook != null) {
|
if (plugin.commandBookHook != null) {
|
||||||
isCommandBookCommand = plugin.commandBookHook.isCommandBookCommand(cmd);
|
isCommandBookCommand = plugin.commandBookHook.isCommandBookCommand(cmd);
|
||||||
plugin.logDebug("Is this is a CommandBook command? " + Boolean.toString(isCommandBookCommand));
|
plugin.logDebug("Is this is a CommandBook command? " + Boolean.toString(isCommandBookCommand));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
||||||
|
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
||||||
|
} catch (CommandException ex) {
|
||||||
|
plugin.logDebug("Falling back to ConsoleSender: " + ircCommand.getGameCommand());
|
||||||
|
|
||||||
|
plugin.getServer().dispatchCommand(ircCommand.getIRCConsoleCommandSender(), ircCommand.getGameCommand());
|
||||||
|
ircCommand.getIRCConsoleCommandSender().sendMessage(plugin.tokenizer.ircCommandSentTokenizer(ircCommand.getGameCommand()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ((plugin.getServer().getVersion().contains("MC: 1.8")
|
if ((plugin.getServer().getVersion().contains("MC: 1.8")
|
||||||
&& (plugin.getServer().getVersion().contains("Spigot"))
|
&& (plugin.getServer().getVersion().contains("Spigot"))
|
||||||
&& plugin.getServer().getPluginCommand(cmd) == null
|
&& plugin.getServer().getPluginCommand(cmd) == null
|
||||||
@ -81,7 +96,8 @@ public class CommandQueueWatcher {
|
|||||||
} else {
|
} else {
|
||||||
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
||||||
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} catch (CommandException ce) {
|
} catch (CommandException ce) {
|
||||||
plugin.logError("Error running command: " + ce.getMessage());
|
plugin.logError("Error running command: " + ce.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user