From a4a2fa869050b03bbd48b2285dcb569c28e02660 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 7 Dec 2011 16:37:35 +1100 Subject: [PATCH] Teach the API about Remote Consoles This will allow us to raise events for remote consoles, and provide access to them at a later date. Relates to BUKKIT-220 By: Andrew Ardill --- .../bukkit/command/RemoteConsoleCommandSender.java | 4 ++++ paper-api/src/main/java/org/bukkit/event/Event.java | 6 ++++++ .../org/bukkit/event/server/ServerCommandEvent.java | 11 ++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 paper-api/src/main/java/org/bukkit/command/RemoteConsoleCommandSender.java diff --git a/paper-api/src/main/java/org/bukkit/command/RemoteConsoleCommandSender.java b/paper-api/src/main/java/org/bukkit/command/RemoteConsoleCommandSender.java new file mode 100644 index 0000000000..5ba3c438fe --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/command/RemoteConsoleCommandSender.java @@ -0,0 +1,4 @@ +package org.bukkit.command; + +public interface RemoteConsoleCommandSender extends CommandSender{ +} diff --git a/paper-api/src/main/java/org/bukkit/event/Event.java b/paper-api/src/main/java/org/bukkit/event/Event.java index 25271f73eb..a5aab336cb 100644 --- a/paper-api/src/main/java/org/bukkit/event/Event.java +++ b/paper-api/src/main/java/org/bukkit/event/Event.java @@ -505,6 +505,12 @@ public abstract class Event implements Serializable { * @see org.bukkit.event.server.ServerCommandEvent */ SERVER_COMMAND (Category.SERVER), + /** + * Called when a remote server command is called + * + * @see org.bukkit.event.server.ServerCommandEvent + */ + REMOTE_COMMAND(Category.SERVER), /** * Called when a map is initialized (created or loaded into memory) * diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java index 2d87be99d9..b33044ed00 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java @@ -9,10 +9,15 @@ import org.bukkit.command.ConsoleCommandSender; public class ServerCommandEvent extends ServerEvent { private String command; private CommandSender sender; + @Deprecated public ServerCommandEvent(ConsoleCommandSender console, String message) { - super(Type.SERVER_COMMAND); - command = message; - sender = console; + this(Type.SERVER_COMMAND, console, message); + } + + public ServerCommandEvent(Type type, CommandSender sender, String command) { + super(type); + this.command = command; + this.sender = sender; } /**