Fix "Attempt to get java.util.List field 'PacketOpcodes.BANNED_PACKETS' with illegal data type conversion to int"

This commit is contained in:
Benjamin Elsdon 2022-05-17 18:34:01 +08:00 committed by Melledy
parent c147ebda8f
commit fffa5a9c47

View File

@ -17,10 +17,12 @@ public class PacketOpcodesUtil {
Field[] fields = PacketOpcodes.class.getFields();
for (Field f : fields) {
try {
opcodeMap.put(f.getInt(null), f.getName());
} catch (Exception e) {
e.printStackTrace();
if(f.getType().equals(int.class)) {
try {
opcodeMap.put(f.getInt(null), f.getName());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}