summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-31 10:45:22 +1000
committermd_5 <git@md-5.net>2018-07-31 10:45:22 +1000
commit61e81e7467cfd84c311509af20ae5dd7bbbc9aaf (patch)
tree0fc488c5285cd65d1be890c87e6bbef03698d112 /src/main
parentdc8ffa26f9b18c05eced401a782077d88351b28c (diff)
downloadbukkit-61e81e7467cfd84c311509af20ae5dd7bbbc9aaf.tar
bukkit-61e81e7467cfd84c311509af20ae5dd7bbbc9aaf.tar.gz
bukkit-61e81e7467cfd84c311509af20ae5dd7bbbc9aaf.tar.lz
bukkit-61e81e7467cfd84c311509af20ae5dd7bbbc9aaf.tar.xz
bukkit-61e81e7467cfd84c311509af20ae5dd7bbbc9aaf.zip
SPIGOT-4029: Add event for commands being sent to client
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerCommandSendEvent.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerCommandSendEvent.java b/src/main/java/org/bukkit/event/player/PlayerCommandSendEvent.java
new file mode 100644
index 00000000..fbdecdcc
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerCommandSendEvent.java
@@ -0,0 +1,51 @@
+package org.bukkit.event.player;
+
+import java.util.Collection;
+import org.bukkit.Warning;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+
+/**
+ * This event is called when the list of available server commands is sent to
+ * the player.
+ * <br>
+ * Commands may be removed from display using this event, but implementations
+ * are not required to securely remove all traces of the command. If secure
+ * removal of commands is required, then the command should be assigned a
+ * permission which is not granted to the player.
+ *
+ * @deprecated draft API
+ */
+@Deprecated
+@Warning(false)
+public class PlayerCommandSendEvent extends PlayerEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Collection<String> commands;
+
+ public PlayerCommandSendEvent(final Player player, final Collection<String> commands) {
+ super(player);
+ this.commands = commands;
+ }
+
+ /**
+ * Returns a mutable collection of all top level commands to be sent.
+ * <br>
+ * It is not legal to add entries to this collection, only remove them.
+ * Behaviour of adding entries is undefined.
+ *
+ * @return collection of all commands
+ */
+ public Collection<String> getCommands() {
+ return commands;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}