From d1e91889597add1cb209cc14742043b0de56cb14 Mon Sep 17 00:00:00 2001 From: BONNe Date: Fri, 14 Jun 2019 14:59:47 +0300 Subject: [PATCH] Added ability to explicitly define asynchronous PremadeEvent (#763) * Add ability to define asynchronous event * minor formatting * Removed another line jump --- .../bentobox/api/events/PremadeEvent.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/api/events/PremadeEvent.java b/src/main/java/world/bentobox/bentobox/api/events/PremadeEvent.java index 2c4e5066a..df520217e 100644 --- a/src/main/java/world/bentobox/bentobox/api/events/PremadeEvent.java +++ b/src/main/java/world/bentobox/bentobox/api/events/PremadeEvent.java @@ -8,6 +8,24 @@ import org.bukkit.event.HandlerList; */ public abstract class PremadeEvent extends Event { + /** + * The default constructor is defined for cleaner code. + * This constructor assumes the PremadeEvent is synchronous. + */ + public PremadeEvent() { + this(false); + } + + /** + * This constructor is used to explicitly declare an PremadeEvent as synchronous or asynchronous. + * @param async - true indicates the event will fire asynchronously, false + * by default from default constructor + * @since 1.5.2 + */ + public PremadeEvent(boolean async) { + super(async); + } + private static final HandlerList handlers = new HandlerList(); @Override