public abstract class Handler extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Handler(Session session)
Create a new handler.
|
| Modifier and Type | Method and Description |
|---|---|
StateFlag.State |
getInvincibility(org.bukkit.entity.Player player)
Return whether the player should be invincible.
|
WorldGuardPlugin |
getPlugin()
Get the plugin.
|
Session |
getSession()
Get the session.
|
void |
initialize(org.bukkit.entity.Player player,
org.bukkit.Location current,
ApplicableRegionSet set)
Called when the session is first being created or
/wg flushstates is used. |
boolean |
onCrossBoundary(org.bukkit.entity.Player player,
org.bukkit.Location from,
org.bukkit.Location to,
ApplicableRegionSet toSet,
Set<ProtectedRegion> entered,
Set<ProtectedRegion> exited,
MoveType moveType)
Called when a player has moved into a new location where either
there are fewer regions or more regions.
|
boolean |
testMoveTo(org.bukkit.entity.Player player,
org.bukkit.Location from,
org.bukkit.Location to,
ApplicableRegionSet toSet,
MoveType moveType)
Called when
Session.testMoveTo(Player, Location, MoveType) is called. |
void |
tick(org.bukkit.entity.Player player,
ApplicableRegionSet set)
Called periodically (at least once every second) by
SessionManager in the server's main thread. |
protected Handler(Session session)
session - The sessionpublic WorldGuardPlugin getPlugin()
public Session getSession()
public void initialize(org.bukkit.entity.Player player,
org.bukkit.Location current,
ApplicableRegionSet set)
/wg flushstates is used.player - The playercurrent - The player's current locationset - The regions for the current locationpublic boolean testMoveTo(org.bukkit.entity.Player player,
org.bukkit.Location from,
org.bukkit.Location to,
ApplicableRegionSet toSet,
MoveType moveType)
Session.testMoveTo(Player, Location, MoveType) is called.
If this method returns false, then no other handlers
will be run (for this move attempt).
player - The playerfrom - The previous, valid, locationto - The new location to testtoSet - The regions for the new locationmoveType - The type of movementpublic boolean onCrossBoundary(org.bukkit.entity.Player player,
org.bukkit.Location from,
org.bukkit.Location to,
ApplicableRegionSet toSet,
Set<ProtectedRegion> entered,
Set<ProtectedRegion> exited,
MoveType moveType)
This is called only if the move test
(Session.testMoveTo(Player, Location, MoveType)) was successful.
If this method returns false, then no other handlers
will be run (for this move attempt).
player - The playerfrom - The previous, valid, locationto - The new location to testtoSet - The regions for the new locationentered - The list of regions that have been enteredexited - The list of regions that have been leftmoveType - The type of movepublic void tick(org.bukkit.entity.Player player,
ApplicableRegionSet set)
SessionManager in the server's main thread.player - The playerset - The regions for the player's current location@Nullable public StateFlag.State getInvincibility(org.bukkit.entity.Player player)
StateFlag.State.DENY can be returned to prevent invincibility
even if another handler permits it.
player - The playerCopyright © 2015. All Rights Reserved.