From 6267ef8becfd627877f53edee3996f5ab6e5f550 Mon Sep 17 00:00:00 2001 From: Redempt Date: Fri, 16 Sep 2022 01:12:09 -0400 Subject: [PATCH] Fix ClassCastException in EventListener --- res/plugin.yml | 2 +- src/redempt/redlib/misc/EventListener.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/res/plugin.yml b/res/plugin.yml index b06377e..98ed3fc 100755 --- a/res/plugin.yml +++ b/res/plugin.yml @@ -1,6 +1,6 @@ name: RedLib main: redempt.redlib.RedLib -version: 2022-09-16 03:17 +version: 2022-09-16 05:12 author: Redempt api-version: 1.13 load: STARTUP diff --git a/src/redempt/redlib/misc/EventListener.java b/src/redempt/redlib/misc/EventListener.java index a861308..068f0ed 100644 --- a/src/redempt/redlib/misc/EventListener.java +++ b/src/redempt/redlib/misc/EventListener.java @@ -109,7 +109,9 @@ public EventListener(Plugin plugin, Class eventClass, Consumer handler) { @EventHandler public void handleEvent(T event) { - handler.accept(this, event); + if (eventClass.isAssignableFrom(event.getClass())) { + handler.accept(this, event); + } } /**