mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
SPIGOT-4029: Add event for commands being sent to client
By: md_5 <git@md-5.net>
This commit is contained in:
parent
5c60cb3a92
commit
21e4c28d42
1 changed files with 51 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue