diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/BedrockCodecHelper.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/BedrockCodecHelper.java index 6cc5cf15b..b554a5674 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/BedrockCodecHelper.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/BedrockCodecHelper.java @@ -198,7 +198,7 @@ default Object readTagLE(ByteBuf buffer) { void readPlayerAbilities(ByteBuf buffer, PlayerAbilityHolder abilityHolder); - PlayerPermission readPlayerPermission(ByteBuf buffer); + PlayerPermission readPlayerPermission(int ordinal); - void writePlayerPermission(ByteBuf buffer, PlayerPermission permission); + int writePlayerPermission(PlayerPermission permission); } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/NoopBedrockCodecHelper.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/NoopBedrockCodecHelper.java index 5f98a5404..355f24b9d 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/NoopBedrockCodecHelper.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/NoopBedrockCodecHelper.java @@ -148,12 +148,12 @@ public void readPlayerAbilities(ByteBuf buffer, PlayerAbilityHolder abilityHolde } @Override - public PlayerPermission readPlayerPermission(ByteBuf buffer) { + public PlayerPermission readPlayerPermission(final int ordinal) { throw new UnsupportedOperationException(); } @Override - public void writePlayerPermission(ByteBuf buffer, PlayerPermission permission) { + public int writePlayerPermission(PlayerPermission permission) { throw new UnsupportedOperationException(); } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java index e79a1abb3..b0b9b5cf0 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java @@ -388,8 +388,7 @@ public void writeOptional(ByteBuf buffer, Predicate isPresent, T object, } @Override - public PlayerPermission readPlayerPermission(ByteBuf buffer) { - final int ordinal = VarInts.readInt(buffer); + public PlayerPermission readPlayerPermission(final int ordinal) { if (ordinal < 0 || ordinal >= PLAYER_PERMISSIONS.length) { return null; } else { @@ -398,7 +397,7 @@ public PlayerPermission readPlayerPermission(ByteBuf buffer) { } @Override - public void writePlayerPermission(ByteBuf buffer, PlayerPermission permission) { - VarInts.writeInt(buffer, permission == null ? -1 : permission.ordinal()); + public int writePlayerPermission(PlayerPermission permission) { + return permission == null ? -1 : permission.ordinal(); } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/serializer/StartGameSerializer_v291.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/serializer/StartGameSerializer_v291.java index 3327aa93e..d3737c933 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/serializer/StartGameSerializer_v291.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/serializer/StartGameSerializer_v291.java @@ -102,7 +102,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); buffer.writeBoolean(packet.isTrustingPlayers()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); VarInts.writeInt(buffer, packet.getXblBroadcastMode().ordinal()); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.getPlatformBroadcastMode() != GamePublishSetting.NO_MULTI_PLAY); @@ -136,7 +136,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); packet.setTrustingPlayers(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); buffer.readBoolean(); // Broadcasting to Platform diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v332/serializer/StartGameSerializer_v332.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v332/serializer/StartGameSerializer_v332.java index 00f613079..8468a8845 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v332/serializer/StartGameSerializer_v332.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v332/serializer/StartGameSerializer_v332.java @@ -38,7 +38,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta helper.writeArray(buffer, packet.getGamerules(), helper::writeGameRule); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -72,7 +72,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star helper.readArray(buffer, packet.getGamerules(), helper::readGameRule); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v407/serializer/StartGameSerializer_v407.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v407/serializer/StartGameSerializer_v407.java index 14e1effb5..7cd07fc98 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v407/serializer/StartGameSerializer_v407.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v407/serializer/StartGameSerializer_v407.java @@ -61,7 +61,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta helper.writeArray(buffer, packet.getGamerules(), helper::writeGameRule); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -105,7 +105,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star helper.readArray(buffer, packet.getGamerules(), helper::readGameRule); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v419/serializer/StartGameSerializer_v419.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v419/serializer/StartGameSerializer_v419.java index 49aa24f03..23ee1234e 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v419/serializer/StartGameSerializer_v419.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v419/serializer/StartGameSerializer_v419.java @@ -116,7 +116,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -161,7 +161,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v465/serializer/StartGameSerializer_v465.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v465/serializer/StartGameSerializer_v465.java index 40da6dff5..cb75cec97 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v465/serializer/StartGameSerializer_v465.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v465/serializer/StartGameSerializer_v465.java @@ -46,7 +46,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -94,7 +94,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v503/Bedrock_v503.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v503/Bedrock_v503.java index 922ba9919..94a0577c1 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v503/Bedrock_v503.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v503/Bedrock_v503.java @@ -4,7 +4,6 @@ import lombok.NoArgsConstructor; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; import org.cloudburstmc.protocol.bedrock.codec.EntityDataTypeMap; -import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.AvailableCommandsSerializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.EntityEventSerializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelEventSerializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelSoundEvent1Serializer_v291; diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/BedrockCodecHelper_v534.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/BedrockCodecHelper_v534.java index 7070df5d9..45975e44b 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/BedrockCodecHelper_v534.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/BedrockCodecHelper_v534.java @@ -9,7 +9,6 @@ import org.cloudburstmc.protocol.bedrock.data.Ability; import org.cloudburstmc.protocol.bedrock.data.AbilityLayer; import org.cloudburstmc.protocol.bedrock.data.PlayerAbilityHolder; -import org.cloudburstmc.protocol.bedrock.data.PlayerPermission; import org.cloudburstmc.protocol.bedrock.data.command.CommandPermission; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; @@ -35,7 +34,7 @@ public BedrockCodecHelper_v534(EntityDataTypeMap entityData, TypeMap> g @Override public void readPlayerAbilities(ByteBuf buffer, PlayerAbilityHolder abilityHolder) { abilityHolder.setUniqueEntityId(buffer.readLongLE()); - abilityHolder.setPlayerPermission(PLAYER_PERMISSIONS[buffer.readUnsignedByte()]); + abilityHolder.setPlayerPermission(readPlayerPermission(buffer.readUnsignedByte())); abilityHolder.setCommandPermission(CommandPermission.values()[buffer.readUnsignedByte()]); this.readArray(buffer, abilityHolder.getAbilityLayers(), this::readAbilityLayer); } @@ -53,7 +52,7 @@ protected AbilityLayer readAbilityLayer(ByteBuf buffer) { @Override public void writePlayerAbilities(ByteBuf buffer, PlayerAbilityHolder abilityHolder) { buffer.writeLongLE(abilityHolder.getUniqueEntityId()); - buffer.writeByte(abilityHolder.getPlayerPermission().ordinal()); + buffer.writeByte(writePlayerPermission(abilityHolder.getPlayerPermission())); buffer.writeByte(abilityHolder.getCommandPermission().ordinal()); this.writeArray(buffer, abilityHolder.getAbilityLayers(), this::writeAbilityLayer); } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/Bedrock_v534.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/Bedrock_v534.java index f49859d54..aef3dc1df 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/Bedrock_v534.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/Bedrock_v534.java @@ -5,7 +5,6 @@ import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelSoundEvent1Serializer_v291; import org.cloudburstmc.protocol.bedrock.codec.v313.serializer.LevelSoundEvent2Serializer_v313; import org.cloudburstmc.protocol.bedrock.codec.v332.serializer.LevelSoundEventSerializer_v332; -import org.cloudburstmc.protocol.bedrock.codec.v503.BedrockCodecHelper_v503; import org.cloudburstmc.protocol.bedrock.codec.v527.Bedrock_v527; import org.cloudburstmc.protocol.bedrock.codec.v534.serializer.*; import org.cloudburstmc.protocol.bedrock.data.Ability; diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/serializer/StartGameSerializer_v534.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/serializer/StartGameSerializer_v534.java index 3a393bee9..58303728f 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/serializer/StartGameSerializer_v534.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v534/serializer/StartGameSerializer_v534.java @@ -47,7 +47,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -96,7 +96,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v544/serializer/StartGameSerializer_v544.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v544/serializer/StartGameSerializer_v544.java index 80eade243..9060e6b60 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v544/serializer/StartGameSerializer_v544.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v544/serializer/StartGameSerializer_v544.java @@ -53,7 +53,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -106,7 +106,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v557/serializer/AddPlayerSerializer_v557.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v557/serializer/AddPlayerSerializer_v557.java index af10f7f42..8ea623701 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v557/serializer/AddPlayerSerializer_v557.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v557/serializer/AddPlayerSerializer_v557.java @@ -3,7 +3,6 @@ import io.netty.buffer.ByteBuf; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; import org.cloudburstmc.protocol.bedrock.codec.v534.serializer.AddPlayerSerializer_v534; -import org.cloudburstmc.protocol.bedrock.codec.v534.serializer.UpdateAbilitiesSerializer_v534; import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket; import org.cloudburstmc.protocol.common.util.VarInts; diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/ClientCheatAbilitySerializer_v567.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/ClientCheatAbilitySerializer_v567.java index 1bbc92df7..2ba8725a3 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/ClientCheatAbilitySerializer_v567.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/ClientCheatAbilitySerializer_v567.java @@ -3,7 +3,6 @@ import io.netty.buffer.ByteBuf; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; -import org.cloudburstmc.protocol.bedrock.codec.v534.serializer.UpdateAbilitiesSerializer_v534; import org.cloudburstmc.protocol.bedrock.packet.ClientCheatAbilityPacket; public class ClientCheatAbilitySerializer_v567 implements BedrockPacketSerializer { diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/StartGameSerializer_v567.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/StartGameSerializer_v567.java index 15e752f72..912776a1c 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/StartGameSerializer_v567.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v567/serializer/StartGameSerializer_v567.java @@ -40,7 +40,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -94,7 +94,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/OpenSignSerializer_v582.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/OpenSignSerializer_v582.java index 517f655a0..a3a3a435e 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/OpenSignSerializer_v582.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/OpenSignSerializer_v582.java @@ -5,10 +5,7 @@ import lombok.NoArgsConstructor; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; -import org.cloudburstmc.protocol.bedrock.data.TrimMaterial; -import org.cloudburstmc.protocol.bedrock.data.TrimPattern; import org.cloudburstmc.protocol.bedrock.packet.OpenSignPacket; -import org.cloudburstmc.protocol.bedrock.packet.TrimDataPacket; @NoArgsConstructor(access = AccessLevel.PROTECTED) public class OpenSignSerializer_v582 implements BedrockPacketSerializer { diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/StartGameSerializer_v582.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/StartGameSerializer_v582.java index 0abe70793..c1571e569 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/StartGameSerializer_v582.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/StartGameSerializer_v582.java @@ -54,7 +54,7 @@ protected void writeLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Sta buffer.writeBoolean(packet.isExperimentsPreviouslyToggled()); buffer.writeBoolean(packet.isBonusChestEnabled()); buffer.writeBoolean(packet.isStartingWithMap()); - helper.writePlayerPermission(buffer, packet.getDefaultPlayerPermission()); + VarInts.writeInt(buffer, helper.writePlayerPermission(packet.getDefaultPlayerPermission())); buffer.writeIntLE(packet.getServerChunkTickRange()); buffer.writeBoolean(packet.isBehaviorPackLocked()); buffer.writeBoolean(packet.isResourcePackLocked()); @@ -110,7 +110,7 @@ protected void readLevelSettings(ByteBuf buffer, BedrockCodecHelper helper, Star packet.setExperimentsPreviouslyToggled(buffer.readBoolean()); packet.setBonusChestEnabled(buffer.readBoolean()); packet.setStartingWithMap(buffer.readBoolean()); - packet.setDefaultPlayerPermission(helper.readPlayerPermission(buffer)); + packet.setDefaultPlayerPermission(helper.readPlayerPermission(VarInts.readInt(buffer))); packet.setServerChunkTickRange(buffer.readIntLE()); packet.setBehaviorPackLocked(buffer.readBoolean()); packet.setResourcePackLocked(buffer.readBoolean()); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/TrimDataSerializer_v582.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/TrimDataSerializer_v582.java index 273527252..8149a5861 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/TrimDataSerializer_v582.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v582/serializer/TrimDataSerializer_v582.java @@ -3,7 +3,6 @@ import io.netty.buffer.ByteBuf; import lombok.AccessLevel; import lombok.NoArgsConstructor; -import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; import org.cloudburstmc.protocol.bedrock.data.TrimMaterial; diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/crafting/recipe/SmithingTrimRecipeData.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/crafting/recipe/SmithingTrimRecipeData.java index 27bd83265..30cff8eec 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/crafting/recipe/SmithingTrimRecipeData.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/crafting/recipe/SmithingTrimRecipeData.java @@ -1,7 +1,6 @@ package org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe; import lombok.*; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingDataType; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount;