package net.knarcraft.stargate.event; import net.knarcraft.stargate.portal.Portal; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** * This event should be called whenever a player teleports through a stargate * *
This event can be used to overwrite the location the player is teleported to.
*/ @SuppressWarnings("unused") public class StargatePlayerPortalEvent extends StargatePlayerEvent { private static final HandlerList handlers = new HandlerList(); private final Portal destination; private Location exit; /** * Instantiates a new stargate player portal event * * @param playerThe player teleporting
* @param portalThe portal the player entered from
* @param destinationThe destination the player should exit from
* @param exitThe exit location of the destination portal the user will be teleported to
*/ public StargatePlayerPortalEvent(Player player, Portal portal, Portal destination, Location exit) { super(portal, player); this.destination = destination; this.exit = exit; } /** * Return the destination portal * * @returnThe destination portal
*/ public Portal getDestination() { return destination; } /** * Return the location of the players exit point * * @returnLocation of the exit point
*/ public Location getExit() { return exit; } /** * Set the location of the player's exit point * * @param locationThe new location of the player's exit point
*/ public void setExit(Location location) { this.exit = location; } /** * Gets a handler-list containing all event handlers * * @returnA handler-list with all event handlers
*/ public static HandlerList getHandlerList() { return handlers; } @Override @NotNull public HandlerList getHandlers() { return handlers; } }