From 911ec9b9712e6ddee8ca831ca58198951ffec281 Mon Sep 17 00:00:00 2001 From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Date: Wed, 18 Jun 2025 10:34:54 -0700 Subject: [PATCH] Fix Carpet protocol (#552) --- .../leaves/protocol/CarpetServerProtocol.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java index 9f7fad36..b5dd7f71 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java @@ -35,28 +35,24 @@ public class CarpetServerProtocol implements LeavesProtocol { @ProtocolHandler.PlayerJoin public static void onPlayerJoin(ServerPlayer player) { - if (LeavesConfig.protocol.leavesCarpetSupport) { - CompoundTag data = new CompoundTag(); - data.putString(HI, VERSION); - ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data)); - } + CompoundTag data = new CompoundTag(); + data.putString(HI, VERSION); + ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data)); } @ProtocolHandler.PayloadReceiver(payload = CarpetPayload.class) private static void handleHello(@NotNull ServerPlayer player, @NotNull CarpetServerProtocol.CarpetPayload payload) { - if (LeavesConfig.protocol.leavesCarpetSupport) { - if (payload.nbt.contains(HELLO)) { - LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + payload.nbt.getString(HELLO)); - CompoundTag data = new CompoundTag(); - CarpetRules.write(data); - ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data)); - } + if (payload.nbt.contains(HELLO)) { + LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + payload.nbt.getString(HELLO)); + CompoundTag data = new CompoundTag(); + CarpetRules.write(data); + ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data)); } } @Override public boolean isActive() { - return false; + return LeavesConfig.protocol.leavesCarpetSupport; } public static class CarpetRules {