Added event to fire when expansion is unregistered

This commit is contained in:
extendedclip 2018-03-24 12:43:57 -04:00
parent bec4782b40
commit a7b5a1ea08

View File

@ -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<CloudExpansion> {
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;
}
}