mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Added event to fire when expansion is unregistered
This commit is contained in:
parent
bec4782b40
commit
a7b5a1ea08
@ -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 HandlerList handlers = new HandlerList();
|
||||||
private static final int LAST = 1;
|
private PlaceholderExpansion expansion;
|
||||||
private static final int RATING = 2;
|
|
||||||
private static final int TO_UPDATE = 3;
|
|
||||||
private int compare_mode = LAST;
|
|
||||||
|
|
||||||
public ExpansionComparator() { }
|
public ExpansionUnregisterEvent(PlaceholderExpansion expansion) {
|
||||||
|
this.expansion = expansion;
|
||||||
public ExpansionComparator(int compare_mode) {
|
|
||||||
this.compare_mode = compare_mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(CloudExpansion o1, CloudExpansion o2) {
|
public HandlerList getHandlers() {
|
||||||
switch (compare_mode) {
|
return handlers;
|
||||||
case LAST:
|
|
||||||
return (int) (o2.getLastUpdate() - o1.getLastUpdate());
|
|
||||||
default:
|
|
||||||
return o1.getAuthor().compareTo(o2.getAuthor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlaceholderExpansion getExpansion() {
|
||||||
|
return expansion;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user