diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java index f687af73..4c3cc0ff 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java @@ -39,7 +39,7 @@ public class ServerWindowPropertyPacket implements Packet { } public & WindowProperty> T getProperty(Class type) { - return MagicValues.key(type, value); + return MagicValues.key(type, this.value); } public int getValue() { diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java index 32bade81..3e7981ea 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java @@ -42,8 +42,9 @@ public class ServerBlockBreakAnimPacket implements Packet { public void read(NetInput in) throws IOException { this.breakerEntityId = in.readVarInt(); this.position = NetUtil.readPosition(in); - this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte()); - if(this.stage == null) { + try { + this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte()); + } catch(IllegalArgumentException e) { this.stage = BlockBreakStage.RESET; } } diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java index afce8ffc..7a0366c7 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java @@ -59,8 +59,9 @@ public class ServerPlaySoundPacket implements Packet { @Override public void read(NetInput in) throws IOException { String value = in.readString(); - this.sound = MagicValues.key(GenericSound.class, value); - if(this.sound == null) { + try { + this.sound = MagicValues.key(GenericSound.class, value); + } catch(IllegalArgumentException e) { this.sound = new CustomSound(value); }