Package com.sk89q.worldedit.entity
Interface Player
- All Superinterfaces:
Actor
,Entity
,Faceted
,Identifiable
,Locatable
,MapMetadatable
,Metadatable
,SessionOwner
,Subject
- All Known Implementing Classes:
AbstractPlayerActor
,AsyncPlayer
,LocationMaskedPlayerWrapper
,PlayerProxy
,SilentPlayerWrapper
Represents a player.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fastasyncworldedit.core.entity.Metadatable
Metadatable.METADATA_KEYS
-
Field Summary
Fields inherited from interface com.sk89q.worldedit.util.Identifiable
CONSOLE, EVERYONE
-
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
Go up one level to the next free space above.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.Region[]
Get the player's current allowed WorldEdit regions.Region[]
Get the player's current allowed WorldEdit regions.default Location
Deprecated.Use Locatable#getBlockLocationgetBlockInHand
(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.Region[]
Get the player's current disallowed WorldEdit regions.Region[]
Get the player's current disallowed WorldEdit regions.Return this actor's game mode.Get this actor's block bag.getItemInHand
(HandSide handSide) Get the item that the player is holding.Get the largest region in the player's allowed WorldEdit region.default Region
Get the player's selection region.getSolidBlockTrace
(int range) Get the point of the block being looked at.getWorld()
Return the world that the player is on.default World
Get the world the player is editing in.void
giveItem
(BaseItemStack itemStack) Gives the player an item.boolean
Returns true if the entity is holding a pick axe.default void
Loads any history items from disk: - Should already be called if history on disk is enabled.boolean
passThroughForwardWall
(int range) Pass through the wall that you are looking at.<B extends BlockStateHolder<B>>
voidsendFakeBlock
(BlockVector3 pos, B block) Sends a fake block to the client.void
sendTitle
(com.sk89q.worldedit.util.formatting.text.Component title, com.sk89q.worldedit.util.formatting.text.Component sub) void
setGameMode
(GameMode gameMode) Sets the player to the given game mode.void
setOnGround
(Location searchPos) Set the actor on the ground.default void
setPosition
(Vector3 pos, float pitch, float yaw) Deprecated.This method may fail without indication.void
setSelection
(Region region) Set a players selection and selector type to the given regiondefault void
setSelection
(RegionSelector selector) Set the player's WorldEdit selection.default boolean
trySetPosition
(Vector3 pos, float pitch, float yaw) Attempt to move the player.default void
Unregister this player, deleting all data stored during the login session.Methods inherited from interface com.sk89q.worldedit.extension.platform.Actor
cancel, canDestroyBedrock, checkAction, confirm, decline, dispatchCUIEvent, getDisplayName, getLimit, getLocale, getName, isPlayer, openFileOpenDialog, openFileSaveDialog, print, print, printDebug, printDebug, printError, printError, printInfo, printRaw, queueAction, runAction, runAsyncIfFree, runIfFree, sendAnnouncements
Methods inherited from interface com.sk89q.worldedit.util.Identifiable
getUniqueId
Methods inherited from interface com.sk89q.worldedit.extension.platform.Locatable
getBlockLocation, getExtent, getLocation, setLocation, setPosition, trySetPosition
Methods inherited from interface com.fastasyncworldedit.core.entity.MapMetadatable
deleteMeta, getAndSetMeta, getMeta, getMeta, getRawMeta, hasMeta, putIfAbsent, setMeta
Methods inherited from interface com.sk89q.worldedit.session.SessionOwner
getSession, getSessionKey
Methods inherited from interface com.sk89q.worldedit.util.auth.Subject
checkPermission, getGroups, hasPermission, setPermission, togglePermission
-
Method Details
-
getWorld
World getWorld()Return the world that the player is on.- Returns:
- the world
-
isHoldingPickAxe
boolean isHoldingPickAxe()Returns true if the entity is holding a pick axe.- Returns:
- whether a pick axe is held
-
getCardinalDirection
Get the player's cardinal direction (N, W, NW, etc.) with an offset. May return null.- Parameters:
yawOffset
- offset that is added to the player's yaw before determining the cardinal direction- Returns:
- the direction
-
getItemInHand
Get the item that the player is holding.- Returns:
- the item the player is holding
-
getBlockInHand
Get the Block that the player is holding.- Returns:
- the item id of the item the player is holding
- Throws:
WorldEditException
-
giveItem
Gives the player an item.- Parameters:
itemStack
- The item to give
-
getInventoryBlockBag
BlockBag getInventoryBlockBag()Get this actor's block bag.- Returns:
- the actor's block bag
-
getGameMode
GameMode getGameMode()Return this actor's game mode.- Returns:
- the game mode
-
setGameMode
Sets the player to the given game mode.- Parameters:
gameMode
- The game mode
-
findFreePosition
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.- Parameters:
searchPos
- search position
-
setOnGround
Set the actor on the ground.- Parameters:
searchPos
- The location to start searching from
-
findFreePosition
void findFreePosition()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. -
ascendLevel
boolean ascendLevel()Go up one level to the next free space above.- Returns:
- true if a spot was found
-
descendLevel
boolean descendLevel()Go up one level to the next free space above.- Returns:
- true if a spot was found
-
ascendToCeiling
boolean ascendToCeiling(int clearance) Ascend to the ceiling above.- Parameters:
clearance
- How many blocks to leave above the player's head- Returns:
- whether the player was moved
-
ascendToCeiling
boolean ascendToCeiling(int clearance, boolean alwaysGlass) Ascend to the ceiling above.- 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
boolean ascendUpwards(int distance) Just go up.- Parameters:
distance
- How far up to teleport- Returns:
- whether the player was moved
-
ascendUpwards
boolean ascendUpwards(int distance, boolean alwaysGlass) Just go up.- Parameters:
distance
- How far up to teleportalwaysGlass
- Always put glass under the player- Returns:
- whether the player was moved
-
floatAt
void floatAt(int x, int y, int z, boolean alwaysGlass) Make the player float in the given blocks.- Parameters:
x
- The X coordinate of the block to float iny
- The Y coordinate of the block to float inz
- The Z coordinate of the block to float in
-
getBlockIn
Deprecated.Use Locatable#getBlockLocationGet the point of the block that is being stood in.- Returns:
- point
-
getBlockOn
Location getBlockOn()Get the point of the block that is being stood upon.- Returns:
- point
-
getBlockTrace
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.- Parameters:
range
- how far to checks for blocksuseLastBlock
- try to return the last valid air block found- Returns:
- point
-
getBlockTrace
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.- 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
Get the face that the player is looking at.- Parameters:
range
- the rangeuseLastBlock
- try to return the last valid air block found- Returns:
- a face
-
getBlockTraceFace
Get the face that the player is looking at.- 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
Get the point of the block being looked at. May return null.- Parameters:
range
- How far to checks for blocks- Returns:
- point
-
getSolidBlockTrace
Get the point of the block being looked at. May return null.- Parameters:
range
- How far to checks for blocks- Returns:
- point
-
getCardinalDirection
Direction getCardinalDirection()Get the player's cardinal direction (N, W, NW, etc.). May return null.- Returns:
- the direction
-
passThroughForwardWall
boolean passThroughForwardWall(int range) Pass through the wall that you are looking at.- Parameters:
range
- How far to checks for blocks- Returns:
- whether the player was pass through
-
setPosition
Deprecated.This method may fail without indication. UsetrySetPosition(Vector3, float, float)
insteadMove the player.- Parameters:
pos
- where to move thempitch
- the pitch (up/down) of the player's view in degreesyaw
- the yaw (left/right) of the player's view in degrees
-
trySetPosition
@NonAbstractForCompatibility(delegateName="setPosition", delegateParams={Vector3.class,float.class,float.class}) default boolean trySetPosition(Vector3 pos, float pitch, float yaw) Attempt to move the player.This action may fail, due to other mods cancelling the move. If so, this method will return
false
.- Parameters:
pos
- where to move thempitch
- the pitch (up/down) of the player's view in degreesyaw
- the yaw (left/right) of the player's view in degrees- Returns:
- if the move was able to occur
-
sendFakeBlock
Sends a fake block to the client.This block isn't real.
- Parameters:
pos
- The position of the blockblock
- The block to send, null to reset
-
getAllowedRegions
Region[] getAllowedRegions()Get the player's current allowed WorldEdit regions.- Returns:
- an array of allowed regions
-
getAllowedRegions
Get the player's current allowed WorldEdit regions.- Parameters:
type
- Mask type; whether to check if the player is an owner of a member of the regions- Returns:
- an array of allowed regions
-
getDisallowedRegions
Region[] getDisallowedRegions()Get the player's current disallowed WorldEdit regions. Effectively a blacklist.- Returns:
- an array of disallowed regions
-
getDisallowedRegions
Get the player's current disallowed WorldEdit regions. Effectively a blacklist.- Parameters:
type
- Mask type; whether to check if the player is an owner of a member of the regions- Returns:
- an array of disallowed regions
-
getLargestRegion
Region getLargestRegion()Get the largest region in the player's allowed WorldEdit region. -
setSelection
Set a players selection and selector type to the given region -
getSelection
Get the player's selection region. If the selection is defined in a different world, theIncompleteRegionException
exception will be thrown.- Returns:
- a region
- Throws:
IncompleteRegionException
- if no region is selected
-
setSelection
Set the player's WorldEdit selection.- Parameters:
selector
- the selector
-
getWorldForEditing
Get the world the player is editing in. The world may or may not match the world they are in. For example, if they are editing a CFI world.- Returns:
- Editing world
-
unregister
default void unregister()Unregister this player, deleting all data stored during the login session. -
sendTitle
void sendTitle(com.sk89q.worldedit.util.formatting.text.Component title, com.sk89q.worldedit.util.formatting.text.Component sub) -
loadClipboardFromDisk
default void loadClipboardFromDisk()Loads any history items from disk: - Should already be called if history on disk is enabled.
-