From b455db4172846c42f0c0849eace37db31e127020 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 2 Jun 2017 14:17:08 +0200 Subject: [PATCH] Added ShopInitializedEvent --- .../java/de/epiceric/shopchest/ShopChest.java | 2 ++ .../shopchest/event/ShopInitializedEvent.java | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/java/de/epiceric/shopchest/event/ShopInitializedEvent.java diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index 3c480f8..f3f72e1 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -6,6 +6,7 @@ import com.wasteofplastic.askyblock.ASkyBlock; import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.config.HologramFormat; import de.epiceric.shopchest.config.Placeholder; +import de.epiceric.shopchest.event.ShopInitializedEvent; import de.epiceric.shopchest.external.PlotSquaredShopFlag; import de.epiceric.shopchest.language.LanguageUtils; import de.epiceric.shopchest.language.LocalizedMessage; @@ -378,6 +379,7 @@ public class ShopChest extends JavaPlugin { public void onResult(Object result) { if (result instanceof Integer) { int count = (int) result; + Bukkit.getServer().getPluginManager().callEvent(new ShopInitializedEvent(count)); getLogger().info("Initialized " + count + " Shops"); debug("Initialized " + count + " Shops"); } diff --git a/src/main/java/de/epiceric/shopchest/event/ShopInitializedEvent.java b/src/main/java/de/epiceric/shopchest/event/ShopInitializedEvent.java new file mode 100644 index 0000000..1eb0a09 --- /dev/null +++ b/src/main/java/de/epiceric/shopchest/event/ShopInitializedEvent.java @@ -0,0 +1,27 @@ +package de.epiceric.shopchest.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ShopInitializedEvent extends Event { + + private static final HandlerList handlers = new HandlerList(); + private int amount; + + public ShopInitializedEvent(int amount) { + this.amount = amount; + } + + public int getAmount() { + return amount; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } +}