Use the correct plugin message packet. Thanks, Camo

This commit is contained in:
Tim203 2021-05-31 16:54:02 +02:00
parent db583135eb
commit 209a4ffc42
No known key found for this signature in database
GPG key ID: 064EE9F5BF7C3EE8

View file

@ -25,7 +25,7 @@
package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
import com.google.common.base.Charsets;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession;
@ -74,12 +74,7 @@ public class PluginMessageUtils {
}
public static void sendMessage(GeyserSession session, String channel, byte[] data) {
byte[] finalData =
ByteBuffer.allocate(data.length + getVarIntLength(data.length))
.put(writeVarInt(data.length))
.put(data)
.array();
session.sendDownstreamPacket(new ServerPluginMessagePacket(channel, finalData));
session.sendDownstreamPacket(new ClientPluginMessagePacket(channel, data));
}
private static byte[] writeVarInt(int value) {