From a1e095bba763e14304f1cb76f6e4352a76803b4a Mon Sep 17 00:00:00 2001 From: Benjamin Elsdon Date: Tue, 17 May 2022 18:34:01 +0800 Subject: [PATCH] Fix "Attempt to get java.util.List field 'PacketOpcodes.BANNED_PACKETS' with illegal data type conversion to int" --- .../emu/grasscutter/net/packet/PacketOpcodesUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtil.java b/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtil.java index 6395a7d4d..ff7be1e45 100644 --- a/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtil.java +++ b/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtil.java @@ -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(); + } } } }