if (tokens.size() == 0) {
notifyError("Wrong number of arguments!");
return; // no command to execute
}
Player p = server.findPlayer(tokens.remove(0));
if (p == null) {
notifyError("Player not found!");
return;
}
String message = server.options.getBoolean("useSlashes") ? "/" : "!";
for (String token : tokens) {
message += token + " ";
}
message = message.substring(0, message.length() - 1);
// execute the server command, overriding the player permissions
p.parseCommand(message, true);
// handle forwarding
String cmd = tokens.get(0);
PlayerCommand command = server.resolvePlayerCommand(cmd, p.getGroup());
// forwarding if necessary
CommandConfig config = server.config.commands.getTopConfig(cmd);
if ((command instanceof ExternalCommand)
|| (config != null && config.forwarding != Forwarding.NONE)
|| server.config.properties.getBoolean("forwardAllCommands")) {
p.forwardMessage(message);
}
}