From ab86400e80c9a90f7242a626223de1f42fd3cf17 Mon Sep 17 00:00:00 2001 From: Felix Cravic Date: Sat, 15 Aug 2020 13:42:27 +0200 Subject: [PATCH] Fix Player#sendPluginMessage --- src/main/java/net/minestom/server/entity/Player.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index e5c0c127b..9a8bffb00 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -624,7 +624,13 @@ public class Player extends LivingEntity implements CommandSender { * @param message the message */ public void sendPluginMessage(String channel, String message) { - sendPluginMessage(channel, message.getBytes()); + // Write the data + PacketWriter writer = new PacketWriter(); + writer.writeSizedString(message); + // Retrieve the data + final byte[] data = writer.toByteArray(); + + sendPluginMessage(channel, data); } /**