mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-28 11:29:12 +00:00
Fix Carpet protocol (#552)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user