Class AsyncPlayer

All Implemented Interfaces:
MapMetadatable, Metadatable, Entity, Player, Actor, Locatable, SessionOwner, Subject, Faceted, Identifiable, Cloneable
Direct Known Subclasses:
LocationMaskedPlayerWrapper, SilentPlayerWrapper

public class AsyncPlayer extends PlayerProxy
  • Constructor Details

    • AsyncPlayer

      public AsyncPlayer(Player parent)
  • Method Details

    • wrap

      public static AsyncPlayer wrap(Player parent)
    • getWorld

      public World getWorld()
      Description copied from interface: Player
      Return the world that the player is on.
      Specified by:
      getWorld in interface Player
      Overrides:
      getWorld in class PlayerProxy
      Returns:
      the world
    • 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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
    • 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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
      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 PlayerProxy
      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
    • setPosition

      public void setPosition(Vector3 pos, float pitch, float yaw)
      Description copied from interface: Player
      Move the player.
      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
    • getBlockTrace

      public Location getBlockTrace(int range, boolean useLastBlock)
      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 interface Player
      Overrides:
      getBlockTrace in class AbstractPlayerActor
      Parameters:
      range - how far to checks for blocks
      useLastBlock - try to return the last valid air block found
      Returns:
      point
    • getBlockTraceFace

      public Location getBlockTraceFace(int range, boolean useLastBlock)
      Description copied from interface: Player
      Get the face that the player is looking at.
      Specified by:
      getBlockTraceFace in interface Player
      Overrides:
      getBlockTraceFace in class AbstractPlayerActor
      Parameters:
      range - the range
      useLastBlock - try to return the last valid air block found
      Returns:
      a face
    • getSolidBlockTrace

      public Location getSolidBlockTrace(int range)
      Description copied from interface: Player
      Get the point of the block being looked at. May return null.
      Specified by:
      getSolidBlockTrace in interface Player
      Overrides:
      getSolidBlockTrace in class AbstractPlayerActor
      Parameters:
      range - How far to checks for blocks
      Returns:
      point
    • getCardinalDirection

      public Direction getCardinalDirection()
      Description copied from interface: Player
      Get the player's cardinal direction (N, W, NW, etc.). May return null.
      Specified by:
      getCardinalDirection in interface Player
      Overrides:
      getCardinalDirection in class AbstractPlayerActor
      Returns:
      the direction
    • passThroughForwardWall

      public boolean passThroughForwardWall(int range)
      Description copied from interface: Player
      Pass through the wall that you are looking at.
      Specified by:
      passThroughForwardWall in interface Player
      Overrides:
      passThroughForwardWall in class AbstractPlayerActor
      Parameters:
      range - How far to checks for blocks
      Returns:
      whether the player was pass through