1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-08-31 01:59:48 +02:00

Only form data buf once in Bukkit PluginMessage messenger

This commit is contained in:
Luck
2019-01-23 12:12:12 +00:00
parent b744e35ad8
commit 5db999f995

View File

@@ -69,6 +69,10 @@ public class PluginMessageMessenger implements Messenger, PluginMessageListener
@Override
public void sendOutgoingMessage(@NonNull OutgoingMessage outgoingMessage) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(outgoingMessage.asEncodedString());
byte[] data = out.toByteArray();
new BukkitRunnable() {
@Override
public void run() {
@@ -78,11 +82,6 @@ public class PluginMessageMessenger implements Messenger, PluginMessageListener
return;
}
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(outgoingMessage.asEncodedString());
byte[] data = out.toByteArray();
p.sendPluginMessage(PluginMessageMessenger.this.plugin.getBootstrap(), CHANNEL, data);
cancel();
}