Put default getHandlers back in for backwards compatibility

Without them, too many older addons break. They need updating to have
their own handlers. Once that is done, the default ones can be removed
maybe.
This commit is contained in:
tastybento 2021-10-09 09:29:52 -07:00
parent d3e7b55be5
commit 536d7ef1c3
1 changed files with 20 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import java.util.Map;
import java.util.Objects;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
@ -21,6 +23,24 @@ import world.bentobox.bentobox.BentoBox;
*/
public abstract class BentoBoxEvent extends Event {
private static final HandlerList handlers = new HandlerList();
/**
* This is here just for backwards compatibility. Users of BentoBoxEvent should implement their own getHandlers
*/
@Override
public @NonNull HandlerList getHandlers() {
return getHandlerList();
}
/**
* This is here just for backwards compatibility. Users of BentoBoxEvent should implement their own getHandlers
* @return HandlerList
*/
public static HandlerList getHandlerList() {
return handlers;
}
/**
* The default constructor is defined for cleaner code.
* This constructor assumes the BentoBoxEvent is synchronous.