From 60c93932ad16f6d162ce5984a84dda955cfd1353 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Tue, 26 Apr 2022 14:09:00 -0400 Subject: [PATCH] Fix handlers --- .../grasscutter/server/event/EventHandler.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/event/EventHandler.java b/src/main/java/emu/grasscutter/server/event/EventHandler.java index ec0eaffe5..4522cc2c6 100644 --- a/src/main/java/emu/grasscutter/server/event/EventHandler.java +++ b/src/main/java/emu/grasscutter/server/event/EventHandler.java @@ -4,8 +4,12 @@ import emu.grasscutter.Grasscutter; import java.util.function.Consumer; -public final class EventHandler { - private E event; +public final class EventHandler { + private final Class event; + + public EventHandler(Class event) { + this.event = event; + } private Consumer listener; private HandlerPriority priority; @@ -15,7 +19,7 @@ public final class EventHandler { * Gets which event this handler is handling. * @return An event class. */ - public Event handles() { + public Class handles() { return this.event; } @@ -48,7 +52,7 @@ public final class EventHandler { * @param listener An event handler method. * @return Method chaining. */ - public EventHandler listener(Consumer listener) { + public EventHandler listener(Consumer listener) { this.listener = listener; return this; } @@ -57,7 +61,7 @@ public final class EventHandler { * @param priority The priority of the handler. * @return Method chaining. */ - public EventHandler priority(HandlerPriority priority) { + public EventHandler priority(HandlerPriority priority) { this.priority = priority; return this; } @@ -66,7 +70,7 @@ public final class EventHandler { * @param ignore If the handler should ignore cancelled events. * @return Method chaining. */ - public EventHandler ignore(boolean ignore) { + public EventHandler ignore(boolean ignore) { this.handleCanceled = ignore; return this; }