Class AbstractPlayerActor
java.lang.Object
com.sk89q.worldedit.extension.platform.AbstractPlayerActor
- All Implemented Interfaces:
Entity
,Player
,Actor
,Locatable
,SessionOwner
,Subject
,Faceted
,Identifiable
,Cloneable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Go up one level to the next free space above.boolean
ascendToCeiling
(int clearance) Ascend to the ceiling above.boolean
ascendToCeiling
(int clearance, boolean alwaysGlass) Ascend to the ceiling above.boolean
ascendUpwards
(int distance) Just go up.boolean
ascendUpwards
(int distance, boolean alwaysGlass) Just go up.boolean
Returns true if the actor can destroy bedrock.void
checkPermission
(String permission) Check whether this subject has been granted the given permission and throw an exception on error.clone()
boolean
Go up one level to the next free space above.void
dispatchCUIEvent
(CUIEvent event) Send a CUI event.boolean
void
Find a position for the player to stand that is not inside a block.void
findFreePosition
(Location searchPos) Find a position for the actor to stand that is not inside a block.void
floatAt
(int x, int y, int z, boolean alwaysGlass) Make the player float in the given blocks.getBlockInHand
(HandSide handSide) Get the Block that the player is holding.Get the point of the block that is being stood upon.getBlockTrace
(int range) Get the point of the block being looked at.getBlockTrace
(int range, boolean useLastBlock) Get the point of the block being looked at.getBlockTrace
(int range, boolean useLastBlock, Mask stopMask) Get the point of the block being looked at.getBlockTraceFace
(int range, boolean useLastBlock) Get the face that the player is looking at.getBlockTraceFace
(int range, boolean useLastBlock, Mask stopMask) Get the face that the player is looking at.Get the player's cardinal direction (N, W, NW, etc.).getCardinalDirection
(int yawOffset) Get the player's cardinal direction (N, W, NW, etc.) with an offset.final Extent
Get the extent that this actor is in.Return this actor's game mode.getSolidBlockTrace
(int range) Get the point of the block being looked at.int
hashCode()
protected boolean
Check whether the player is allowed to fly.boolean
Returns true if the entity is holding a pick axe.boolean
isPlayer()
Return whether this actor is a player.openFileOpenDialog
(String[] extensions) Open a file open dialog.openFileSaveDialog
(String[] extensions) Open a file save dialog.boolean
passThroughForwardWall
(int range) Pass through the wall that you are looking at.boolean
remove()
Remove this entity from it container.<B extends BlockStateHolder<B>>
voidsendFakeBlock
(BlockVector3 pos, B block) Sends a fake block to the client.protected void
setFlying
(boolean flying) Set whether the player is currently flying.void
setGameMode
(GameMode gameMode) Sets the player to the given game mode.void
setOnGround
(Location searchPos) Set the actor on the ground.boolean
trySetPosition
(Vector3 pos) Attempts to set the position of this actor.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extension.platform.Actor
getDisplayName, getLocale, getName, print, print, printDebug, printDebug, printError, printError, printInfo, printRaw, sendAnnouncements
Methods inherited from interface com.sk89q.worldedit.util.Identifiable
getUniqueId
Methods inherited from interface com.sk89q.worldedit.extension.platform.Locatable
getBlockLocation, getLocation, setLocation, setPosition
Methods inherited from interface com.sk89q.worldedit.entity.Player
getBlockIn, getInventoryBlockBag, getItemInHand, getWorld, giveItem, setPosition, trySetPosition
Methods inherited from interface com.sk89q.worldedit.session.SessionOwner
getSessionKey
Methods inherited from interface com.sk89q.worldedit.util.auth.Subject
getGroups, hasPermission
-
Constructor Details
-
AbstractPlayerActor
public AbstractPlayerActor()
-
-
Method Details
-
getExtent
Description copied from interface:Locatable
Get the extent that this actor is in. -
isHoldingPickAxe
public boolean isHoldingPickAxe()Description copied from interface:Player
Returns true if the entity is holding a pick axe.- Specified by:
isHoldingPickAxe
in interfacePlayer
- Returns:
- whether a pick axe is held
-
findFreePosition
Description copied from interface:Player
Find a position for the actor to stand that is not inside a block. Blocks above the player will be iteratively tested until there is a series of two free blocks. The actor will be teleported to that free position.- Specified by:
findFreePosition
in interfacePlayer
- Parameters:
searchPos
- search position
-
setOnGround
Description copied from interface:Player
Set the actor on the ground.- Specified by:
setOnGround
in interfacePlayer
- Parameters:
searchPos
- The location to start searching from
-
findFreePosition
public void findFreePosition()Description copied from interface:Player
Find a position for the player to stand that is not inside a block. Blocks above the player will be iteratively tested until there is a series of two free blocks. The player will be teleported to that free position.- Specified by:
findFreePosition
in interfacePlayer
-
ascendLevel
public boolean ascendLevel()Description copied from interface:Player
Go up one level to the next free space above.- Specified by:
ascendLevel
in interfacePlayer
- Returns:
- true if a spot was found
-
descendLevel
public boolean descendLevel()Description copied from interface:Player
Go up one level to the next free space above.- Specified by:
descendLevel
in interfacePlayer
- Returns:
- true if a spot was found
-
ascendToCeiling
public boolean ascendToCeiling(int clearance) Description copied from interface:Player
Ascend to the ceiling above.- Specified by:
ascendToCeiling
in interfacePlayer
- Parameters:
clearance
- How many blocks to leave above the player's head- Returns:
- whether the player was moved
-
ascendToCeiling
public boolean ascendToCeiling(int clearance, boolean alwaysGlass) Description copied from interface:Player
Ascend to the ceiling above.- Specified by:
ascendToCeiling
in interfacePlayer
- Parameters:
clearance
- How many blocks to leave above the player's headalwaysGlass
- Always put glass under the player- Returns:
- whether the player was moved
-
ascendUpwards
public boolean ascendUpwards(int distance) Description copied from interface:Player
Just go up.- Specified by:
ascendUpwards
in interfacePlayer
- Parameters:
distance
- How far up to teleport- Returns:
- whether the player was moved
-
ascendUpwards
public boolean ascendUpwards(int distance, boolean alwaysGlass) Description copied from interface:Player
Just go up.- Specified by:
ascendUpwards
in interfacePlayer
- Parameters:
distance
- How far up to teleportalwaysGlass
- Always put glass under the player- Returns:
- whether the player was moved
-
floatAt
public void floatAt(int x, int y, int z, boolean alwaysGlass) Description copied from interface:Player
Make the player float in the given blocks. -
isAllowedToFly
protected boolean isAllowedToFly()Check whether the player is allowed to fly.- Returns:
- true if allowed flight
-
setFlying
protected void setFlying(boolean flying) Set whether the player is currently flying.- Parameters:
flying
- true to fly
-
getBlockOn
Description copied from interface:Player
Get the point of the block that is being stood upon.- Specified by:
getBlockOn
in interfacePlayer
- Returns:
- point
-
getBlockTrace
Description copied from interface:Player
Get the point of the block being looked at. May return null. Will return the farthest away air block if useLastBlock is true and no other block is found.- Specified by:
getBlockTrace
in interfacePlayer
- Parameters:
range
- how far to checks for blocksuseLastBlock
- try to return the last valid air block found- Returns:
- point
-
getBlockTraceFace
Description copied from interface:Player
Get the face that the player is looking at.- Specified by:
getBlockTraceFace
in interfacePlayer
- Parameters:
range
- the rangeuseLastBlock
- try to return the last valid air block found- Returns:
- a face
-
getBlockTrace
Description copied from interface:Player
Get the point of the block being looked at. May return null. Will return the farthest away block before matching the stop mask if useLastBlock is true and no other block is found.- Specified by:
getBlockTrace
in interfacePlayer
- Parameters:
range
- how far to checks for blocksuseLastBlock
- try to return the last valid block not matching the stop mask foundstopMask
- the mask used to determine when to stop tracing- Returns:
- point
-
getBlockTraceFace
Description copied from interface:Player
Get the face that the player is looking at.- Specified by:
getBlockTraceFace
in interfacePlayer
- Parameters:
range
- the rangeuseLastBlock
- try to return the last valid block not matching the stop mask foundstopMask
- the mask used to determine when to stop tracing- Returns:
- a face
-
getBlockTrace
Description copied from interface:Player
Get the point of the block being looked at. May return null.- Specified by:
getBlockTrace
in interfacePlayer
- Parameters:
range
- How far to checks for blocks- Returns:
- point
-
getSolidBlockTrace
Description copied from interface:Player
Get the point of the block being looked at. May return null.- Specified by:
getSolidBlockTrace
in interfacePlayer
- Parameters:
range
- How far to checks for blocks- Returns:
- point
-
getCardinalDirection
Description copied from interface:Player
Get the player's cardinal direction (N, W, NW, etc.). May return null.- Specified by:
getCardinalDirection
in interfacePlayer
- Returns:
- the direction
-
getCardinalDirection
Description copied from interface:Player
Get the player's cardinal direction (N, W, NW, etc.) with an offset. May return null.- Specified by:
getCardinalDirection
in interfacePlayer
- Parameters:
yawOffset
- offset that is added to the player's yaw before determining the cardinal direction- Returns:
- the direction
-
getBlockInHand
Description copied from interface:Player
Get the Block that the player is holding.- Specified by:
getBlockInHand
in interfacePlayer
- Returns:
- the item id of the item the player is holding
- Throws:
WorldEditException
-
passThroughForwardWall
public boolean passThroughForwardWall(int range) Description copied from interface:Player
Pass through the wall that you are looking at.- Specified by:
passThroughForwardWall
in interfacePlayer
- Parameters:
range
- How far to checks for blocks- Returns:
- whether the player was pass through
-
trySetPosition
Description copied from interface:Locatable
Attempts to set the position of this actor.This action may fail, due to other mods cancelling the move. If so, this method will return
false
.- Specified by:
trySetPosition
in interfaceLocatable
- Parameters:
pos
- the position to set- Returns:
- if the position was able to be set
-
openFileOpenDialog
Description copied from interface:Actor
Open a file open dialog.- Specified by:
openFileOpenDialog
in interfaceActor
- Parameters:
extensions
- null to allow all- Returns:
- the selected file or null if something went wrong
-
openFileSaveDialog
Description copied from interface:Actor
Open a file save dialog.- Specified by:
openFileSaveDialog
in interfaceActor
- Parameters:
extensions
- null to allow all- Returns:
- the selected file or null if something went wrong
-
canDestroyBedrock
public boolean canDestroyBedrock()Description copied from interface:Actor
Returns true if the actor can destroy bedrock.- Specified by:
canDestroyBedrock
in interfaceActor
- Returns:
- true if bedrock can be broken by the actor
-
dispatchCUIEvent
Description copied from interface:Actor
Send a CUI event.- Specified by:
dispatchCUIEvent
in interfaceActor
- Parameters:
event
- the event
-
equals
-
hashCode
public int hashCode() -
checkPermission
Description copied from interface:Subject
Check whether this subject has been granted the given permission and throw an exception on error.- Specified by:
checkPermission
in interfaceSubject
- Parameters:
permission
- the permission- Throws:
AuthorizationException
- thrown if not permitted
-
isPlayer
public boolean isPlayer()Description copied from interface:Actor
Return whether this actor is a player. -
getGameMode
Description copied from interface:Player
Return this actor's game mode.- Specified by:
getGameMode
in interfacePlayer
- Returns:
- the game mode
-
setGameMode
Description copied from interface:Player
Sets the player to the given game mode.- Specified by:
setGameMode
in interfacePlayer
- Parameters:
gameMode
- The game mode
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
remove
public boolean remove()Description copied from interface:Entity
Remove this entity from it container. -
sendFakeBlock
Description copied from interface:Player
Sends a fake block to the client.This block isn't real.
- Specified by:
sendFakeBlock
in interfacePlayer
- Parameters:
pos
- The position of the blockblock
- The block to send, null to reset
-