Added onPlayerChat and onPlayerCommand
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
55
paper-api/src/org/bukkit/event/player/PlayerChatEvent.java
Normal file
55
paper-api/src/org/bukkit/event/player/PlayerChatEvent.java
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Player;
|
||||
|
||||
/**
|
||||
* Holds information for player chat and commands
|
||||
*/
|
||||
public class PlayerChatEvent extends PlayerEvent {
|
||||
private boolean cancel = false;
|
||||
private String message;
|
||||
|
||||
public PlayerChatEvent(final Type type, final Player player, final String message) {
|
||||
super(type, player);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message that the player is attempting to send
|
||||
*
|
||||
* @return Message the player is attempting to send
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that the player will send
|
||||
*
|
||||
* @param message New message that the player will send
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
@@ -19,8 +20,25 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Called when a player leaves a server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerQuit(PlayerEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player sends a chat message
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to use a command
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user