From a7b5a1ea089f59722a6c14f24aa2311aead92ca0 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Sat, 24 Mar 2018 12:43:57 -0400 Subject: [PATCH] Added event to fire when expansion is unregistered --- .../ExpansionUnregisterEvent.java} | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) rename src/main/java/me/clip/placeholderapi/{expansion/cloud/ExpansionComparator.java => events/ExpansionUnregisterEvent.java} (51%) diff --git a/src/main/java/me/clip/placeholderapi/expansion/cloud/ExpansionComparator.java b/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java similarity index 51% rename from src/main/java/me/clip/placeholderapi/expansion/cloud/ExpansionComparator.java rename to src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java index 9545206..c9efa16 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/cloud/ExpansionComparator.java +++ b/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java @@ -18,31 +18,32 @@ * * */ -package me.clip.placeholderapi.expansion.cloud; +package me.clip.placeholderapi.events; -import java.util.Comparator; +import me.clip.placeholderapi.PlaceholderHook; +import me.clip.placeholderapi.expansion.PlaceholderExpansion; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; -public class ExpansionComparator implements Comparator { +public class ExpansionUnregisterEvent extends Event { - private static final int AUTHOR = 0; - private static final int LAST = 1; - private static final int RATING = 2; - private static final int TO_UPDATE = 3; - private int compare_mode = LAST; + private static final HandlerList handlers = new HandlerList(); + private PlaceholderExpansion expansion; - public ExpansionComparator() { } - - public ExpansionComparator(int compare_mode) { - this.compare_mode = compare_mode; + public ExpansionUnregisterEvent(PlaceholderExpansion expansion) { + this.expansion = expansion; } @Override - public int compare(CloudExpansion o1, CloudExpansion o2) { - switch (compare_mode) { - case LAST: - return (int) (o2.getLastUpdate() - o1.getLastUpdate()); - default: - return o1.getAuthor().compareTo(o2.getAuthor()); - } + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public PlaceholderExpansion getExpansion() { + return expansion; } }