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

public class PlayerProxy extends AbstractPlayerActor
  • Constructor Details

    • PlayerProxy

      public PlayerProxy(Player player)
    • PlayerProxy

      public PlayerProxy(Player basePlayer, Actor permActor, Actor cuiActor, World world)
  • Method Details

    • getUniqueId

      public UUID getUniqueId()
      Description copied from interface: Identifiable
      Get the UUID for this object.
      Returns:
      the UUID
    • getItemInHand

      public BaseItemStack getItemInHand(HandSide handSide)
      Description copied from interface: Player
      Get the item that the player is holding.
      Returns:
      the item the player is holding
    • giveItem

      public void giveItem(BaseItemStack itemStack)
      Description copied from interface: Player
      Gives the player an item.
      Parameters:
      itemStack - The item to give
    • getInventoryBlockBag

      public BlockBag getInventoryBlockBag()
      Description copied from interface: Player
      Get this actor's block bag.
      Returns:
      the actor's block bag
    • getName

      public String getName()
      Description copied from interface: Actor
      Get the name of the actor.
      Returns:
      String
    • getDisplayName

      public 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

      public BaseEntity 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

      public Location getLocation()
      Description copied from interface: Locatable
      Get the location of this actor.
      Returns:
      the location of the actor
    • setLocation

      public boolean setLocation(Location location)
      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

      public boolean trySetPosition(Vector3 pos, float pitch, float yaw)
      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 them
      pitch - the pitch (up/down) of the player's view in degrees
      yaw - the yaw (left/right) of the player's view in degrees
      Returns:
      if the move was able to occur
    • getWorld

      public World getWorld()
      Description copied from interface: Player
      Return the world that the player is on.
      Returns:
      the world
    • printRaw

      public void printRaw(String msg)
      Description copied from interface: Actor
      Print a message.
      Parameters:
      msg - The message text
    • printDebug

      public void printDebug(String msg)
      Description copied from interface: Actor
      Print a WorldEdit message.
      Parameters:
      msg - The message text
    • print

      public void print(String msg)
      Description copied from interface: Actor
      Print a WorldEdit message.
      Parameters:
      msg - The message text
    • printError

      public void printError(String msg)
      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 a Component.
      Parameters:
      component - The component to print
    • getGroups

      public String[] 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

      public boolean hasPermission(String perm)
      Description copied from interface: Subject
      Return whether this subject has the given permission.
      Parameters:
      perm - the permission
      Returns:
      true if permission is granted
    • togglePermission

      public boolean togglePermission(String permission)
      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

      public void setPermission(String permission, boolean value)
    • dispatchCUIEvent

      public void dispatchCUIEvent(CUIEvent event)
      Description copied from interface: Actor
      Send a CUI event.
      Specified by:
      dispatchCUIEvent in interface Actor
      Overrides:
      dispatchCUIEvent in class AbstractPlayerActor
      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

      @Nullable public <T> T getFacet(Class<? extends T> cls)
      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

      public SessionKey getSessionKey()
      Description copied from interface: SessionOwner
      Get an object describing this session.
      Returns:
      the status object
    • getGameMode

      public GameMode getGameMode()
      Description copied from interface: Player
      Return this actor's game mode.
      Specified by:
      getGameMode in interface Player
      Overrides:
      getGameMode in class AbstractPlayerActor
      Returns:
      the game mode
    • setGameMode

      public void setGameMode(GameMode gameMode)
      Description copied from interface: Player
      Sets the player to the given game mode.
      Specified by:
      setGameMode in interface Player
      Overrides:
      setGameMode in class AbstractPlayerActor
      Parameters:
      gameMode - The game mode
    • sendFakeBlock

      public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block)
      Description copied from interface: Player
      Sends a fake block to the client.

      This block isn't real.

      Specified by:
      sendFakeBlock in interface Player
      Overrides:
      sendFakeBlock in class AbstractPlayerActor
      Parameters:
      pos - The position of the block
      block - The block to send, null to reset
    • findFreePosition

      public void findFreePosition(Location searchPos)
      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 interface Player
      Overrides:
      findFreePosition in class AbstractPlayerActor
      Parameters:
      searchPos - search position
    • setOnGround

      public void setOnGround(Location searchPos)
      Description copied from interface: Player
      Set the actor on the ground.
      Specified by:
      setOnGround in interface Player
      Overrides:
      setOnGround in class AbstractPlayerActor
      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 interface Player
      Overrides:
      findFreePosition in class AbstractPlayerActor
    • ascendLevel

      public boolean ascendLevel()
      Description copied from interface: Player
      Go up one level to the next free space above.
      Specified by:
      ascendLevel in interface Player
      Overrides:
      ascendLevel in class AbstractPlayerActor
      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 interface Player
      Overrides:
      descendLevel in class AbstractPlayerActor
      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 interface Player
      Overrides:
      ascendToCeiling in class AbstractPlayerActor
      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 interface Player
      Overrides:
      ascendToCeiling in class AbstractPlayerActor
      Parameters:
      clearance - How many blocks to leave above the player's head
      alwaysGlass - 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 interface Player
      Overrides:
      ascendUpwards in class AbstractPlayerActor
      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 interface Player
      Overrides:
      ascendUpwards in class AbstractPlayerActor
      Parameters:
      distance - How far up to teleport
      alwaysGlass - 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 interface Player
      Overrides:
      floatAt in class AbstractPlayerActor
      Parameters:
      x - The X coordinate of the block to float in
      y - The Y coordinate of the block to float in
      z - The Z coordinate of the block to float in
    • getLocale

      public Locale getLocale()
      Description copied from interface: Actor
      Get the locale of this actor.
      Returns:
      The locale
    • unwrap

      public static Player unwrap(Player player)
    • setOffset

      public void setOffset(Vector3 position)
    • getBlockInHand

      public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException
      Description copied from interface: Player
      Get the Block that the player is holding.
      Specified by:
      getBlockInHand in interface Player
      Overrides:
      getBlockInHand in class AbstractPlayerActor
      Returns:
      the item id of the item the player is holding
      Throws:
      WorldEditException
    • runAction

      public boolean runAction(Runnable ifFree, boolean checkFree, boolean async)
      Description copied from class: AbstractPlayerActor
      Run a task either async, or on the current thread.
      Specified by:
      runAction in interface Actor
      Overrides:
      runAction in class AbstractPlayerActor
      Parameters:
      ifFree - the task to run if free
      checkFree - Whether to first check if a task is running
      async - 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

      public Player getBasePlayer()