mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-27 02:21:38 +01:00
Do not size the string in sendPluginMessage
This commit is contained in:
parent
c478bd7af6
commit
22aa9d01ed
@ -61,6 +61,7 @@ import net.minestom.server.world.DimensionType;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -795,18 +796,15 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a plugin message to the player.
|
* Sends a plugin message to the player.
|
||||||
|
* <p>
|
||||||
|
* Message encoded to UTF-8.
|
||||||
*
|
*
|
||||||
* @param channel the message channel
|
* @param channel the message channel
|
||||||
* @param message the message
|
* @param message the message
|
||||||
*/
|
*/
|
||||||
public void sendPluginMessage(@NotNull String channel, @NotNull String message) {
|
public void sendPluginMessage(@NotNull String channel, @NotNull String message) {
|
||||||
// Write the data
|
final byte[] bytes = message.getBytes(StandardCharsets.UTF_8);
|
||||||
BinaryWriter writer = new BinaryWriter();
|
sendPluginMessage(channel, bytes);
|
||||||
writer.writeSizedString(message);
|
|
||||||
// Retrieve the data
|
|
||||||
final byte[] data = writer.toByteArray();
|
|
||||||
|
|
||||||
sendPluginMessage(channel, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user