Search in sources :

Example 1 with RemoteConsoleCommandSender

use of cn.nukkit.command.RemoteConsoleCommandSender 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)

Example 2 with RemoteConsoleCommandSender

use of cn.nukkit.command.RemoteConsoleCommandSender in project Nukkit by Nukkit.

the class TimingsExport method start.

@Override
public synchronized void start() {
    if (this.sender instanceof RemoteConsoleCommandSender) {
        this.sender.sendMessage(new TranslationContainer("nukkit.command.timings.rcon"));
        run();
    } else {
        super.start();
    }
}
Also used : RemoteConsoleCommandSender(cn.nukkit.command.RemoteConsoleCommandSender) TranslationContainer(cn.nukkit.lang.TranslationContainer)

Aggregations

RemoteConsoleCommandSender (cn.nukkit.command.RemoteConsoleCommandSender)2 RemoteServerCommandEvent (cn.nukkit.event.server.RemoteServerCommandEvent)1 TranslationContainer (cn.nukkit.lang.TranslationContainer)1