diff --git a/src/main/java/emu/grasscutter/server/event/EventHandler.java b/src/main/java/emu/grasscutter/server/event/EventHandler.java index 4522cc2c6..f24bc2dee 100644 --- a/src/main/java/emu/grasscutter/server/event/EventHandler.java +++ b/src/main/java/emu/grasscutter/server/event/EventHandler.java @@ -5,9 +5,22 @@ import emu.grasscutter.Grasscutter; import java.util.function.Consumer; public final class EventHandler { - private final Class event; + private final Class event; + + /** + * Creates an instance of {@link EventHandler} for the specified event. + * @param event The event to handle. + * @return An instance of {@link EventHandler}. + */ + public static EventHandler forEvent(Class event) { + return new EventHandler(event); + } - public EventHandler(Class event) { + /** + * @deprecated Will be replaced with a private constructor instead. Use {@link #forEvent(Class)} instead. + */ + @Deprecated(forRemoval = true, since = "1.0.1") + public EventHandler(Class event) { this.event = event; } @@ -19,7 +32,7 @@ public final class EventHandler { * Gets which event this handler is handling. * @return An event class. */ - public Class handles() { + public Class handles() { return this.event; }