Added Player#sendPluginMessage

This commit is contained in:
Felix Cravic 2020-08-15 13:38:57 +02:00
parent 92f914ef2d
commit 939d06cfb5

View File

@ -604,6 +604,29 @@ public class Player extends LivingEntity implements CommandSender {
}
}
/**
* Send a plugin message to the player
*
* @param channel the message channel
* @param data the message data
*/
public void sendPluginMessage(String channel, byte[] data) {
PluginMessagePacket pluginMessagePacket = new PluginMessagePacket();
pluginMessagePacket.channel = channel;
pluginMessagePacket.data = data;
playerConnection.sendPacket(pluginMessagePacket);
}
/**
* Send a plugin message to the player
*
* @param channel the message channel
* @param message the message
*/
public void sendPluginMessage(String channel, String message) {
sendPluginMessage(channel, message.getBytes());
}
/**
* Send a {@link BlockBreakAnimationPacket} packet to the player and his viewers
* Setting {@code destroyStage} to -1 resets the break animation