mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Update usages of MagicValues.key to account for throwing IllegalArgumentException instead of returning null.
This commit is contained in:
parent
1b913851ee
commit
03379f767d
3 changed files with 7 additions and 5 deletions
|
@ -39,7 +39,7 @@ public class ServerWindowPropertyPacket implements Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Enum<T> & WindowProperty> T getProperty(Class<T> type) {
|
public <T extends Enum<T> & WindowProperty> T getProperty(Class<T> type) {
|
||||||
return MagicValues.key(type, value);
|
return MagicValues.key(type, this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
|
|
|
@ -42,8 +42,9 @@ public class ServerBlockBreakAnimPacket implements Packet {
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
this.breakerEntityId = in.readVarInt();
|
this.breakerEntityId = in.readVarInt();
|
||||||
this.position = NetUtil.readPosition(in);
|
this.position = NetUtil.readPosition(in);
|
||||||
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
|
try {
|
||||||
if(this.stage == null) {
|
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
|
||||||
|
} catch(IllegalArgumentException e) {
|
||||||
this.stage = BlockBreakStage.RESET;
|
this.stage = BlockBreakStage.RESET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,9 @@ public class ServerPlaySoundPacket implements Packet {
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
String value = in.readString();
|
String value = in.readString();
|
||||||
this.sound = MagicValues.key(GenericSound.class, value);
|
try {
|
||||||
if(this.sound == null) {
|
this.sound = MagicValues.key(GenericSound.class, value);
|
||||||
|
} catch(IllegalArgumentException e) {
|
||||||
this.sound = new CustomSound(value);
|
this.sound = new CustomSound(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue