2021-02-07 03:37:25 +01:00
|
|
|
package net.knarcraft.stargate.event;
|
|
|
|
|
2021-02-22 17:01:47 +01:00
|
|
|
import net.knarcraft.stargate.portal.Portal;
|
2021-02-07 03:37:25 +01:00
|
|
|
import org.bukkit.event.HandlerList;
|
2021-02-12 00:26:47 +01:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2021-02-07 03:37:25 +01:00
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* This event should be called whenever a stargate is closed
|
|
|
|
*/
|
|
|
|
@SuppressWarnings("unused")
|
2021-02-07 03:37:25 +01:00
|
|
|
public class StargateCloseEvent extends StargateEvent {
|
|
|
|
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
2021-02-20 13:57:04 +01:00
|
|
|
private boolean force;
|
2021-02-07 03:37:25 +01:00
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new stargate closing event
|
|
|
|
*
|
|
|
|
* @param portal <p>The portal to close</p>
|
|
|
|
* @param force <p>Whether to force the gate to close, even if set as always-on</p>
|
|
|
|
*/
|
2021-02-07 03:37:25 +01:00
|
|
|
public StargateCloseEvent(Portal portal, boolean force) {
|
|
|
|
super("StargateCloseEvent", portal);
|
|
|
|
|
|
|
|
this.force = force;
|
|
|
|
}
|
|
|
|
|
2021-02-20 13:57:04 +01:00
|
|
|
/**
|
|
|
|
* Gets a handler-list containing all event handlers
|
|
|
|
*
|
|
|
|
* @return <p>A handler-list with all event handlers</p>
|
|
|
|
*/
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Gets whether to force the stargate to close
|
|
|
|
*
|
|
|
|
* @return <p>Whether to force the stargate to close</p>
|
|
|
|
*/
|
2021-02-07 03:37:25 +01:00
|
|
|
public boolean getForce() {
|
|
|
|
return force;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Sets whether the stargate should be forced to close
|
|
|
|
*
|
|
|
|
* @param force <p>Whether the stargate should be forced to close</p>
|
|
|
|
*/
|
2021-02-07 03:37:25 +01:00
|
|
|
public void setForce(boolean force) {
|
|
|
|
this.force = force;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
@NotNull
|
|
|
|
@Override
|
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
2021-02-07 03:37:25 +01:00
|
|
|
}
|