Class PlayerProxy
java.lang.Object
com.sk89q.worldedit.extension.platform.AbstractPlayerActor
com.sk89q.worldedit.extension.platform.PlayerProxy
- All Implemented Interfaces:
MapMetadatable
,Metadatable
,Entity
,Player
,Actor
,Locatable
,SessionOwner
,Subject
,Faceted
,Identifiable
,Cloneable
- Direct Known Subclasses:
AsyncPlayer
-
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
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerProxy
(Player player) PlayerProxy
(Player basePlayer, Actor permActor, Actor cuiActor, World world) -
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
dispatchCUIEvent
(CUIEvent event) Send a CUI event.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.Gets the display name of the actor.<T> T
Get the facet corresponding to the given class or interface.Return this actor's game mode.String[]
Get a list of groups that this subject is a part of.Get this actor's block bag.getItemInHand
(HandSide handSide) Get the item that the player is holding.Get the locale of this actor.Get the location of this actor.getName()
Get the name of the actor.Get an object describing this session.getState()
Get a copy of the entity's state.Get the UUID for this object.getWorld()
Return the world that the player is on.void
giveItem
(BaseItemStack itemStack) Gives the player an item.boolean
hasPermission
(String perm) Return whether this subject has the given permission.void
print
(com.sk89q.worldedit.util.formatting.text.Component component) Print aComponent
.void
Print a WorldEdit message.void
printDebug
(String msg) Print a WorldEdit message.void
printError
(String msg) Print a WorldEdit error.void
Print a message.boolean
Run a task either async, or on the current thread.void
Sends any relevant notices to the user when they first use WorldEdit in a session.<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.boolean
setLocation
(Location location) Sets the location of this actor.void
void
setOnGround
(Location searchPos) Set the actor on the ground.void
setPermission
(String permission, boolean value) boolean
togglePermission
(String permission) Add and remove permissions from a subject to show and hide certain messages.boolean
trySetPosition
(Vector3 pos, float pitch, float yaw) Attempt to move the player.static Player
Methods inherited from class com.sk89q.worldedit.extension.platform.AbstractPlayerActor
canDestroyBedrock, checkPermission, clone, equals, getAllowedRegions, getAllowedRegions, getBlockOn, getBlockTrace, getBlockTrace, getBlockTrace, getBlockTraceFace, getBlockTraceFace, getCardinalDirection, getCardinalDirection, getDisallowedRegions, getDisallowedRegions, getExtent, getLargestRegion, getRawMeta, getSolidBlockTrace, hashCode, isAllowedToFly, isHoldingPickAxe, isPlayer, openFileOpenDialog, openFileSaveDialog, passThroughForwardWall, remove, setFlying, setSelection, trySetPosition
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
cancel, checkAction, confirm, decline, getLimit, printDebug, printError, printInfo, queueAction, runAsyncIfFree, runIfFree
Methods inherited from interface com.sk89q.worldedit.extension.platform.Locatable
getBlockLocation, setPosition
Methods inherited from interface com.fastasyncworldedit.core.entity.MapMetadatable
deleteMeta, getAndSetMeta, getMeta, getMeta, hasMeta, putIfAbsent, setMeta
Methods inherited from interface com.sk89q.worldedit.entity.Player
getBlockIn, getSelection, getWorldForEditing, loadClipboardFromDisk, setPosition, setSelection, unregister
Methods inherited from interface com.sk89q.worldedit.session.SessionOwner
getSession
-
Constructor Details
-
PlayerProxy
-
PlayerProxy
-
-
Method Details
-
getUniqueId
Description copied from interface:Identifiable
Get the UUID for this object.- Returns:
- the UUID
-
getItemInHand
Description copied from interface:Player
Get the item that the player is holding.- Returns:
- the item the player is holding
-
giveItem
Description copied from interface:Player
Gives the player an item.- Parameters:
itemStack
- The item to give
-
getInventoryBlockBag
Description copied from interface:Player
Get this actor's block bag.- Returns:
- the actor's block bag
-
getName
Description copied from interface:Actor
Get the name of the actor.- Returns:
- String
-
getDisplayName
Description copied from interface:Actor
Gets the display name of the actor. This can be a nickname, and is not guaranteed to be unique.- Returns:
- The display name
-
getState
Description copied from interface:Entity
Get a copy of the entity's state.In some cases, this method may return
null
if a snapshot of the entity can't be created. It may not be possible, for example, to get a snapshot of a player.- Returns:
- the entity's state or null if one cannot be created
-
getLocation
Description copied from interface:Locatable
Get the location of this actor.- Returns:
- the location of the actor
-
setLocation
Description copied from interface:Locatable
Sets the location of this actor.- Parameters:
location
- the new location of the actor- Returns:
- if the teleport succeeded
-
trySetPosition
Description copied from interface:Player
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
-
getWorld
Description copied from interface:Player
Return the world that the player is on.- Returns:
- the world
-
printRaw
Description copied from interface:Actor
Print a message.- Parameters:
msg
- The message text
-
printDebug
Description copied from interface:Actor
Print a WorldEdit message.- Parameters:
msg
- The message text
-
print
Description copied from interface:Actor
Print a WorldEdit message.- Parameters:
msg
- The message text
-
printError
Description copied from interface:Actor
Print a WorldEdit error.- Parameters:
msg
- The error message text
-
print
public void print(com.sk89q.worldedit.util.formatting.text.Component component) Description copied from interface:Actor
Print aComponent
.- Parameters:
component
- The component to print
-
getGroups
Description copied from interface:Subject
Get a list of groups that this subject is a part of.- Returns:
- an array containing a group name per entry
-
hasPermission
Description copied from interface:Subject
Return whether this subject has the given permission.- Parameters:
perm
- the permission- Returns:
- true if permission is granted
-
togglePermission
Description copied from interface:Subject
Add and remove permissions from a subject to show and hide certain messages.- Parameters:
permission
- the permission- Returns:
- false if the permission was removed, true if this subject has permission
-
setPermission
-
dispatchCUIEvent
Description copied from interface:Actor
Send a CUI event.- Specified by:
dispatchCUIEvent
in interfaceActor
- Overrides:
dispatchCUIEvent
in classAbstractPlayerActor
- Parameters:
event
- the event
-
sendAnnouncements
public void sendAnnouncements()Description copied from interface:Actor
Sends any relevant notices to the user when they first use WorldEdit in a session. -
getFacet
Description copied from interface:Faceted
Get the facet corresponding to the given class or interface.- Type Parameters:
T
- the type- Parameters:
cls
- the class or interface- Returns:
- an implementation of the facet or
null
if one is unavailable
-
getSessionKey
Description copied from interface:SessionOwner
Get an object describing this session.- Returns:
- the status object
-
getGameMode
Description copied from interface:Player
Return this actor's game mode.- Specified by:
getGameMode
in interfacePlayer
- Overrides:
getGameMode
in classAbstractPlayerActor
- Returns:
- the game mode
-
setGameMode
Description copied from interface:Player
Sets the player to the given game mode.- Specified by:
setGameMode
in interfacePlayer
- Overrides:
setGameMode
in classAbstractPlayerActor
- Parameters:
gameMode
- The game mode
-
sendFakeBlock
Description copied from interface:Player
Sends a fake block to the client.This block isn't real.
- Specified by:
sendFakeBlock
in interfacePlayer
- Overrides:
sendFakeBlock
in classAbstractPlayerActor
- Parameters:
pos
- The position of the blockblock
- The block to send, null to reset
-
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
- Overrides:
findFreePosition
in classAbstractPlayerActor
- Parameters:
searchPos
- search position
-
setOnGround
Description copied from interface:Player
Set the actor on the ground.- Specified by:
setOnGround
in interfacePlayer
- Overrides:
setOnGround
in classAbstractPlayerActor
- 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
- Overrides:
findFreePosition
in classAbstractPlayerActor
-
ascendLevel
public boolean ascendLevel()Description copied from interface:Player
Go up one level to the next free space above.- Specified by:
ascendLevel
in interfacePlayer
- Overrides:
ascendLevel
in classAbstractPlayerActor
- 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
- Overrides:
descendLevel
in classAbstractPlayerActor
- 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
- Overrides:
ascendToCeiling
in classAbstractPlayerActor
- 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
- Overrides:
ascendToCeiling
in classAbstractPlayerActor
- 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
- Overrides:
ascendUpwards
in classAbstractPlayerActor
- 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
- Overrides:
ascendUpwards
in classAbstractPlayerActor
- 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.- Specified by:
floatAt
in interfacePlayer
- Overrides:
floatAt
in classAbstractPlayerActor
- 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
-
getLocale
Description copied from interface:Actor
Get the locale of this actor.- Returns:
- The locale
-
unwrap
-
setOffset
-
getBlockInHand
Description copied from interface:Player
Get the Block that the player is holding.- Specified by:
getBlockInHand
in interfacePlayer
- Overrides:
getBlockInHand
in classAbstractPlayerActor
- Returns:
- the item id of the item the player is holding
- Throws:
WorldEditException
-
runAction
Description copied from class:AbstractPlayerActor
Run a task either async, or on the current thread.- Specified by:
runAction
in interfaceActor
- Overrides:
runAction
in classAbstractPlayerActor
- Parameters:
ifFree
- the task to run if freecheckFree
- Whether to first check if a task is runningasync
- TODO description- Returns:
- false if the task was ran or queued
-
sendTitle
public void sendTitle(com.sk89q.worldedit.util.formatting.text.Component title, com.sk89q.worldedit.util.formatting.text.Component sub) -
getBasePlayer
-