From 2ddfa9e80f55ff02d85509aaa28f97ab2dffeeaf Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 14 Jun 2022 13:53:26 +0200 Subject: [PATCH] Fix stuff --- src/de/steamwar/network/packets/PacketHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/network/packets/PacketHandler.java b/src/de/steamwar/network/packets/PacketHandler.java index 11b9bcf..333bec6 100644 --- a/src/de/steamwar/network/packets/PacketHandler.java +++ b/src/de/steamwar/network/packets/PacketHandler.java @@ -82,7 +82,11 @@ public abstract class PacketHandler { return; } if (method.getParameterCount() == 2) { - method.invoke(this, packet, metaInfos); + if (metaInfos == null || method.getParameterTypes()[1].isAssignableFrom(metaInfos.getClass())) { + method.invoke(this, packet, metaInfos); + } else { + throw new IllegalArgumentException("MetaInfos is not assignable to " + method.getParameterTypes()[1]); + } } else { method.invoke(this, packet); }