Log error if commands cannot be run on leaving.

This commit is contained in:
tastybento 2019-11-02 17:03:55 -07:00
parent 0324d3e123
commit 1ab7222ca0

View File

@ -170,10 +170,14 @@ public class IslandResetCommand extends ConfirmableCommand {
command = command.replace("[player]", member.getName());
if (command.startsWith("[SUDO]") && member.isOnline()) {
// Execute the command by the player
member.performCommand(command.substring(6));
if (!member.performCommand(command.substring(6))) {
getPlugin().logError("Could not execute leave command for " + member.getName() + ": " + command.substring(6));
}
} else {
// Otherwise execute as the server console
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
if (!getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), command)) {
getPlugin().logError("Could not execute leave command as console: " + command);
}
}
});