mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-13 22:25:53 +01:00
62 lines
1.3 KiB
Java
62 lines
1.3 KiB
Java
package net.minestom.server.event.player;
|
|
|
|
import net.minestom.server.entity.Player;
|
|
import net.minestom.server.event.Event;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* Called when a player send {@link net.minestom.server.network.packet.client.play.ClientPluginMessagePacket}.
|
|
*/
|
|
public class PlayerPluginMessageEvent extends Event {
|
|
|
|
private final Player player;
|
|
private final String identifier;
|
|
private final byte[] message;
|
|
|
|
public PlayerPluginMessageEvent(@NotNull Player player, @NotNull String identifier, @NotNull byte[] message) {
|
|
this.player = player;
|
|
this.identifier = identifier;
|
|
this.message = message;
|
|
}
|
|
|
|
/**
|
|
* Gets the player who sent the message.
|
|
*
|
|
* @return the player
|
|
*/
|
|
@NotNull
|
|
public Player getPlayer() {
|
|
return player;
|
|
}
|
|
|
|
/**
|
|
* Gets the message identifier.
|
|
*
|
|
* @return the identifier
|
|
*/
|
|
@NotNull
|
|
public String getIdentifier() {
|
|
return identifier;
|
|
}
|
|
|
|
/**
|
|
* Gets the message data as a byte array.
|
|
*
|
|
* @return the message
|
|
*/
|
|
@NotNull
|
|
public byte[] getMessage() {
|
|
return message;
|
|
}
|
|
|
|
/**
|
|
* Gets the message data as a String.
|
|
*
|
|
* @return the message
|
|
*/
|
|
@NotNull
|
|
public String getMessageString() {
|
|
return new String(message);
|
|
}
|
|
}
|