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 player

The player teleporting

* @param portal

The portal the player entered from

* @param destination

The destination the player should exit from

* @param exit

The 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 * * @return

The destination portal

*/ public Portal getDestination() { return destination; } /** * Return the location of the players exit point * * @return

Location of the exit point

*/ public Location getExit() { return exit; } /** * Set the location of the player's exit point * * @param location

The new location of the player's exit point

*/ public void setExit(Location location) { this.exit = location; } /** * Gets a handler-list containing all event handlers * * @return

A handler-list with all event handlers

*/ public static HandlerList getHandlerList() { return handlers; } @Override @NotNull public HandlerList getHandlers() { return handlers; } }