1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Removed the 'should encrypt' argument from the 'packet' plugin message

This commit is contained in:
Tim203
2021-12-16 00:11:56 +01:00
parent bf9faad89c
commit a68f400b6e
3 changed files with 8 additions and 22 deletions

View File

@@ -29,15 +29,6 @@ import java.util.UUID;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
public interface Unsafe {
void sendPacket(UUID bedrockPlayer, byte[] packetData, boolean encrypt);
default void sendPacket(UUID bedrockPlayer, byte[] packetData) {
sendPacket(bedrockPlayer, packetData, true);
}
void sendPacket(FloodgatePlayer player, byte[] packetData, boolean encrypt);
default void sendPacket(FloodgatePlayer player, byte[] packetData) {
sendPacket(player, packetData, true);
}
void sendPacket(UUID bedrockPlayer, byte[] packetData);
void sendPacket(FloodgatePlayer player, byte[] packetData);
}

View File

@@ -44,12 +44,12 @@ public final class UnsafeFloodgateApi implements Unsafe {
}
@Override
public void sendPacket(UUID bedrockPlayer, byte[] packetData, boolean encrypt) {
packetChannel.sendPacket(bedrockPlayer, packetData, encrypt, this);
public void sendPacket(UUID bedrockPlayer, byte[] packetData) {
packetChannel.sendPacket(bedrockPlayer, packetData, this);
}
@Override
public void sendPacket(FloodgatePlayer player, byte[] packetData, boolean encrypt) {
sendPacket(player.getCorrectUniqueId(), packetData, encrypt);
public void sendPacket(FloodgatePlayer player, byte[] packetData) {
sendPacket(player.getCorrectUniqueId(), packetData);
}
}

View File

@@ -60,15 +60,10 @@ public final class PacketChannel implements PluginMessageChannel {
return Result.kick("Cannot send packets from Geyser/Floodgate to Floodgate");
}
public boolean sendPacket(UUID player, byte[] packet, boolean encrypt, UnsafeFloodgateApi api) {
public boolean sendPacket(UUID player, byte[] packet, UnsafeFloodgateApi api) {
if (api == null) {
throw new IllegalArgumentException("Can only send a packet using the unsafe api");
}
byte[] finalData = new byte[packet.length + 1];
finalData[0] = (byte) (encrypt ? 1 : 0);
System.arraycopy(packet, 0, finalData, 1, packet.length);
return pluginMessageUtils.sendMessage(player, getIdentifier(), finalData);
return pluginMessageUtils.sendMessage(player, getIdentifier(), packet);
}
}