Class FakePlayer

java.lang.Object
com.shanebeestudios.nms.api.world.entity.FakePlayer

public class FakePlayer extends Object
Represents a fake ServerPlayer

Can create in PlayerApi.spawnFakePlayer(String, Location)

  • Method Details

    • getMCPlayer

      public McPlayer getMCPlayer()
      Get a wrapper Minecraft version of this FakePlayer
      Returns:
      Wrapper of FakePlayer
    • getAttachedEntity

      @Nullable public @Nullable net.minecraft.world.entity.Entity getAttachedEntity()
      Get the Entity this FakePlayer may be attached to

      May be null if this FakePlayer was never attached

      Returns:
      Attached entity if present else null
    • getAttachedBukkitEntity

      public Entity getAttachedBukkitEntity()
      Get the Bukkit Entity this FakePlayer may be attached to

      May be null if this FakePlayer was never attached

      Returns:
      Attached Bukkit Entity if present else null
    • getAttachedMcEntity

      @Nullable public @Nullable McEntity getAttachedMcEntity()
      Get an McEntity this FakePlayer may be attached to

      May be null if this FakePlayer was never attached

      Returns:
      Attached McEntity if present else null
    • attach

      public void attach(net.minecraft.world.entity.Entity entity)
      Attach an entity to a fake player

      This will visually look like the player is doing what the entity would be doing

      Parameters:
      entity - Entity to attach
    • attach

      public void attach(Entity bukkitEntity)
      Attach an entity to a fake player

      This will visually look like the player is doing what the entity would be doing

      Parameters:
      bukkitEntity - Entity to attach
    • teleport

      public void teleport(@NotNull @NotNull Location location)
      Teleport this player to another location

      Currently does not support changing worlds/levels.

      NOTE: If there is an attached entity, its best to just teleport that entity instead.

      Parameters:
      location - Location to teleport to
    • moveTo

      public void moveTo(@NotNull @NotNull Location location)
      Move this player to a new location

      NOTE: Should be <= 8 blocks, this is used for general player movement, not teleporting

      NOTE: If there is an attached entity, just move/teleport that entity instead.

      Parameters:
      location - Location to move player to
    • update

      public void update(@NotNull @NotNull Player player)
      Update for a single Player
      Parameters:
      player - Player to update for
    • update

      public void update()
      Update for all players online
    • removeFromPlayerList

      public void removeFromPlayerList()
      Remove the player from the player list
    • addToPlayerList

      public void addToPlayerList()
      Add the player to the player list
    • remove

      public void remove()
      Remove this fake player
    • getServerPlayer

      public net.minecraft.world.entity.player.Player getServerPlayer()
      Get the Minecraft Player of this FakePlayer
      Returns:
      Minecraft Player
    • toString

      public String toString()
      Overrides:
      toString in class Object