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) {
|
||||
return MagicValues.key(type, value);
|
||||
return MagicValues.key(type, this.value);
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
|
|
|
@ -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);
|
||||
try {
|
||||
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
|
||||
if(this.stage == null) {
|
||||
} catch(IllegalArgumentException e) {
|
||||
this.stage = BlockBreakStage.RESET;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,9 @@ public class ServerPlaySoundPacket implements Packet {
|
|||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
String value = in.readString();
|
||||
try {
|
||||
this.sound = MagicValues.key(GenericSound.class, value);
|
||||
if(this.sound == null) {
|
||||
} catch(IllegalArgumentException e) {
|
||||
this.sound = new CustomSound(value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue