Search in sources :

Example 1 with RemoteServerCommandEvent

use of cn.nukkit.event.server.RemoteServerCommandEvent in project Nukkit by Nukkit.

the class RCON method check.

public void check() {
    if (this.serverThread == null) {
        return;
    } else if (!this.serverThread.isAlive()) {
        return;
    }
    RCONCommand command;
    while ((command = serverThread.receive()) != null) {
        RemoteConsoleCommandSender sender = new RemoteConsoleCommandSender();
        RemoteServerCommandEvent event = new RemoteServerCommandEvent(sender, command.getCommand());
        this.server.getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.server.dispatchCommand(sender, command.getCommand());
        }
        this.serverThread.respond(command.getSender(), command.getId(), TextFormat.clean(sender.getMessages()));
    }
}
Also used : RemoteServerCommandEvent(cn.nukkit.event.server.RemoteServerCommandEvent) RemoteConsoleCommandSender(cn.nukkit.command.RemoteConsoleCommandSender)

Aggregations

RemoteConsoleCommandSender (cn.nukkit.command.RemoteConsoleCommandSender)1 RemoteServerCommandEvent (cn.nukkit.event.server.RemoteServerCommandEvent)1