Package org.bukkit.event.player
Class PlayerPortalEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerMoveEvent
org.bukkit.event.player.PlayerTeleportEvent
org.bukkit.event.player.PlayerPortalEvent
- All Implemented Interfaces:
Cancellable
public class PlayerPortalEvent extends PlayerTeleportEvent
Called when a player is about to teleport because it is in contact with a
portal.
For other entities see EntityPortalEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.player.PlayerTeleportEvent
PlayerTeleportEvent.TeleportCause
-
Field Summary
Fields Modifier and Type Field Description protected TravelAgent
travelAgent
protected boolean
useTravelAgent
-
Constructor Summary
Constructors Constructor Description PlayerPortalEvent(Player player, Location from, Location to, TravelAgent pta)
PlayerPortalEvent(Player player, Location from, Location to, TravelAgent pta, PlayerTeleportEvent.TeleportCause cause)
-
Method Summary
Modifier and Type Method Description static HandlerList
getHandlerList()
HandlerList
getHandlers()
TravelAgent
getPortalTravelAgent()
Gets the Travel Agent used (or not) in this event.void
setPortalTravelAgent(TravelAgent travelAgent)
Sets the Travel Agent used (or not) in this event.boolean
useTravelAgent()
Gets whether or not the Travel Agent will be used.void
useTravelAgent(boolean useTravelAgent)
Sets whether or not the Travel Agent will be used.Methods inherited from class org.bukkit.event.player.PlayerMoveEvent
getFrom, getTo, isCancelled, setCancelled, setFrom, setTo
-
Field Details
-
useTravelAgent
protected boolean useTravelAgent -
travelAgent
-
-
Constructor Details
-
PlayerPortalEvent
-
PlayerPortalEvent
public PlayerPortalEvent(Player player, Location from, Location to, TravelAgent pta, PlayerTeleportEvent.TeleportCause cause)
-
-
Method Details
-
useTravelAgent
public void useTravelAgent(boolean useTravelAgent)Sets whether or not the Travel Agent will be used.If this is set to true, the TravelAgent will try to find a Portal at the
PlayerMoveEvent.getTo()
Location, and will try to create one if there is none.If this is set to false, the
PlayerEvent.getPlayer()
will only be teleported to thePlayerMoveEvent.getTo()
Location.- Parameters:
useTravelAgent
- whether to use the Travel Agent
-
useTravelAgent
public boolean useTravelAgent()Gets whether or not the Travel Agent will be used.If this is set to true, the TravelAgent will try to find a Portal at the
PlayerMoveEvent.getTo()
Location, and will try to create one if there is none.If this is set to false, the
PlayerEvent.getPlayer()
} will only be teleported to thePlayerMoveEvent.getTo()
Location.- Returns:
- whether to use the Travel Agent
-
getPortalTravelAgent
Gets the Travel Agent used (or not) in this event.- Returns:
- the Travel Agent used (or not) in this event
-
setPortalTravelAgent
Sets the Travel Agent used (or not) in this event.- Parameters:
travelAgent
- the Travel Agent used (or not) in this event
-
getHandlers
- Overrides:
getHandlers
in classPlayerTeleportEvent
-
getHandlerList
-