Class OfflinePlayer

java.lang.Object
org.cloudburstmc.server.player.OfflinePlayer
All Implemented Interfaces:
org.cloudburstmc.api.entity.Creature, org.cloudburstmc.api.entity.Entity, org.cloudburstmc.api.inventory.InventoryHolder, org.cloudburstmc.api.player.Player

public class OfflinePlayer extends Object implements org.cloudburstmc.api.player.Player
Represents a player that is currently offline. //TODO Figure out better implementation of Offline players
  • Constructor Details

    • OfflinePlayer

      public OfflinePlayer(org.cloudburstmc.api.Server server, UUID uuid)
      初始化这个OfflinePlayer对象。
      Initializes the object OfflinePlayer.
      Parameters:
      server - 这个玩家所在服务器的Server对象。
      The server this player is in, as a Server object.
      uuid - 这个玩家的UUID。
      UUID of this player.
      Since:
      Nukkit 1.0 | Nukkit API 1.0.0
    • OfflinePlayer

      public OfflinePlayer(org.cloudburstmc.api.Server server, String name)
    • OfflinePlayer

      public OfflinePlayer(org.cloudburstmc.api.Server server, UUID uuid, String name)
  • Method Details

    • isOnline

      public boolean isOnline()
      Specified by:
      isOnline in interface org.cloudburstmc.api.player.Player
    • getName

      public String getName()
      Specified by:
      getName in interface org.cloudburstmc.api.entity.Entity
      Specified by:
      getName in interface org.cloudburstmc.api.player.Player
    • spawnTo

      public void spawnTo(org.cloudburstmc.api.player.Player player)
      Specified by:
      spawnTo in interface org.cloudburstmc.api.entity.Entity
    • spawnToAll

      public void spawnToAll()
      Specified by:
      spawnToAll in interface org.cloudburstmc.api.entity.Entity
    • despawnFrom

      public void despawnFrom(org.cloudburstmc.api.player.Player player)
      Specified by:
      despawnFrom in interface org.cloudburstmc.api.entity.Entity
    • despawnFromAll

      public void despawnFromAll()
      Specified by:
      despawnFromAll in interface org.cloudburstmc.api.entity.Entity
    • getViewers

      public Set<? extends org.cloudburstmc.api.player.Player> getViewers()
      Specified by:
      getViewers in interface org.cloudburstmc.api.entity.Entity
    • attack

      public boolean attack(org.cloudburstmc.api.event.entity.EntityDamageEvent source)
      Specified by:
      attack in interface org.cloudburstmc.api.entity.Entity
    • heal

      public void heal(org.cloudburstmc.api.event.entity.EntityRegainHealthEvent source)
      Specified by:
      heal in interface org.cloudburstmc.api.entity.Entity
    • getHealth

      public float getHealth()
      Specified by:
      getHealth in interface org.cloudburstmc.api.entity.Entity
    • setHealth

      public void setHealth(float health)
      Specified by:
      setHealth in interface org.cloudburstmc.api.entity.Entity
    • getMaxHealth

      public int getMaxHealth()
      Specified by:
      getMaxHealth in interface org.cloudburstmc.api.entity.Entity
    • setMaxHealth

      public void setMaxHealth(int maxHealth)
      Specified by:
      setMaxHealth in interface org.cloudburstmc.api.entity.Entity
    • getLastDamageCause

      public org.cloudburstmc.api.event.entity.EntityDamageEvent getLastDamageCause()
      Specified by:
      getLastDamageCause in interface org.cloudburstmc.api.entity.Entity
    • canCollideWith

      public boolean canCollideWith(org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      canCollideWith in interface org.cloudburstmc.api.entity.Entity
    • getDirection

      public org.cloudburstmc.api.util.Direction getDirection()
      Specified by:
      getDirection in interface org.cloudburstmc.api.entity.Entity
    • getDirectionVector

      public com.nukkitx.math.vector.Vector3f getDirectionVector()
      Specified by:
      getDirectionVector in interface org.cloudburstmc.api.entity.Entity
    • getDirectionPlane

      public com.nukkitx.math.vector.Vector2f getDirectionPlane()
      Specified by:
      getDirectionPlane in interface org.cloudburstmc.api.entity.Entity
    • getHorizontalDirection

      public org.cloudburstmc.api.util.Direction getHorizontalDirection()
      Specified by:
      getHorizontalDirection in interface org.cloudburstmc.api.entity.Entity
    • onUpdate

      public boolean onUpdate(int currentTick)
      Specified by:
      onUpdate in interface org.cloudburstmc.api.entity.Entity
    • getAbsorption

      public float getAbsorption()
      Specified by:
      getAbsorption in interface org.cloudburstmc.api.entity.Entity
    • setAbsorption

      public void setAbsorption(float absorption)
      Specified by:
      setAbsorption in interface org.cloudburstmc.api.entity.Entity
    • setOnFire

      public void setOnFire(int seconds)
      Specified by:
      setOnFire in interface org.cloudburstmc.api.entity.Entity
    • getFireTicks

      public int getFireTicks()
      Specified by:
      getFireTicks in interface org.cloudburstmc.api.entity.Entity
    • extinguish

      public void extinguish()
      Specified by:
      extinguish in interface org.cloudburstmc.api.entity.Entity
    • getNoDamageTicks

      public int getNoDamageTicks()
      Specified by:
      getNoDamageTicks in interface org.cloudburstmc.api.entity.Entity
    • setNoDamageTicks

      public void setNoDamageTicks(int noDamageTicks)
      Specified by:
      setNoDamageTicks in interface org.cloudburstmc.api.entity.Entity
    • getHighestPosition

      public float getHighestPosition()
      Specified by:
      getHighestPosition in interface org.cloudburstmc.api.entity.Entity
    • setHighestPosition

      public void setHighestPosition(float highestPosition)
      Specified by:
      setHighestPosition in interface org.cloudburstmc.api.entity.Entity
    • resetFallDistance

      public void resetFallDistance()
      Specified by:
      resetFallDistance in interface org.cloudburstmc.api.entity.Entity
    • getBoundingBox

      public org.cloudburstmc.api.util.AxisAlignedBB getBoundingBox()
      Specified by:
      getBoundingBox in interface org.cloudburstmc.api.entity.Entity
    • fall

      public void fall(float fallDistance)
      Specified by:
      fall in interface org.cloudburstmc.api.entity.Entity
    • onStruckByLightning

      public void onStruckByLightning(org.cloudburstmc.api.entity.misc.LightningBolt lightningBolt)
      Specified by:
      onStruckByLightning in interface org.cloudburstmc.api.entity.Entity
    • onInteract

      public boolean onInteract(org.cloudburstmc.api.player.Player player, org.cloudburstmc.api.item.ItemStack item, com.nukkitx.math.vector.Vector3f clickedPos)
      Specified by:
      onInteract in interface org.cloudburstmc.api.entity.Entity
    • getX

      public float getX()
      Specified by:
      getX in interface org.cloudburstmc.api.entity.Entity
    • getY

      public float getY()
      Specified by:
      getY in interface org.cloudburstmc.api.entity.Entity
    • getZ

      public float getZ()
      Specified by:
      getZ in interface org.cloudburstmc.api.entity.Entity
    • getPosition

      public com.nukkitx.math.vector.Vector3f getPosition()
      Specified by:
      getPosition in interface org.cloudburstmc.api.entity.Entity
    • setPosition

      public boolean setPosition(com.nukkitx.math.vector.Vector3f pos)
      Specified by:
      setPosition in interface org.cloudburstmc.api.entity.Entity
    • getLocation

      public org.cloudburstmc.api.level.Location getLocation()
      Specified by:
      getLocation in interface org.cloudburstmc.api.entity.Entity
    • getMotion

      public com.nukkitx.math.vector.Vector3f getMotion()
      Specified by:
      getMotion in interface org.cloudburstmc.api.entity.Entity
    • setMotion

      public boolean setMotion(com.nukkitx.math.vector.Vector3f motion)
      Specified by:
      setMotion in interface org.cloudburstmc.api.entity.Entity
    • setRotation

      public void setRotation(float yaw, float pitch)
      Specified by:
      setRotation in interface org.cloudburstmc.api.entity.Entity
    • setPositionAndRotation

      public boolean setPositionAndRotation(com.nukkitx.math.vector.Vector3f pos, float yaw, float pitch)
      Specified by:
      setPositionAndRotation in interface org.cloudburstmc.api.entity.Entity
    • getPitch

      public float getPitch()
      Specified by:
      getPitch in interface org.cloudburstmc.api.entity.Entity
    • getYaw

      public float getYaw()
      Specified by:
      getYaw in interface org.cloudburstmc.api.entity.Entity
    • canBeMovedByCurrents

      public boolean canBeMovedByCurrents()
      Specified by:
      canBeMovedByCurrents in interface org.cloudburstmc.api.entity.Entity
    • canTriggerPressurePlate

      public boolean canTriggerPressurePlate()
      Specified by:
      canTriggerPressurePlate in interface org.cloudburstmc.api.entity.Entity
    • canPassThrough

      public boolean canPassThrough()
      Specified by:
      canPassThrough in interface org.cloudburstmc.api.entity.Entity
    • getServerId

      public UUID getServerId()
      Specified by:
      getServerId in interface org.cloudburstmc.api.player.Player
    • getType

      public org.cloudburstmc.api.entity.EntityType<?> getType()
      Specified by:
      getType in interface org.cloudburstmc.api.entity.Entity
    • getChunk

      public org.cloudburstmc.api.level.chunk.Chunk getChunk()
      Specified by:
      getChunk in interface org.cloudburstmc.api.entity.Entity
    • getServer

      public CloudServer getServer()
      Specified by:
      getServer in interface org.cloudburstmc.api.entity.Entity
      Specified by:
      getServer in interface org.cloudburstmc.api.player.Player
    • getUniqueId

      public long getUniqueId()
      Specified by:
      getUniqueId in interface org.cloudburstmc.api.entity.Entity
    • getRuntimeId

      public long getRuntimeId()
      Specified by:
      getRuntimeId in interface org.cloudburstmc.api.entity.Entity
    • getHeight

      public float getHeight()
      Specified by:
      getHeight in interface org.cloudburstmc.api.entity.Entity
    • getEyeHeight

      public float getEyeHeight()
      Specified by:
      getEyeHeight in interface org.cloudburstmc.api.entity.Entity
    • getWidth

      public float getWidth()
      Specified by:
      getWidth in interface org.cloudburstmc.api.entity.Entity
    • getLength

      public float getLength()
      Specified by:
      getLength in interface org.cloudburstmc.api.entity.Entity
    • canCollide

      public boolean canCollide()
      Specified by:
      canCollide in interface org.cloudburstmc.api.entity.Entity
    • onEntityCollision

      public void onEntityCollision(org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      onEntityCollision in interface org.cloudburstmc.api.entity.Entity
    • getGravity

      public float getGravity()
      Specified by:
      getGravity in interface org.cloudburstmc.api.entity.Entity
    • getDrag

      public float getDrag()
      Specified by:
      getDrag in interface org.cloudburstmc.api.entity.Entity
    • hasNameTag

      public boolean hasNameTag()
      Specified by:
      hasNameTag in interface org.cloudburstmc.api.entity.Entity
    • getNameTag

      public String getNameTag()
      Specified by:
      getNameTag in interface org.cloudburstmc.api.entity.Entity
    • setNameTag

      public void setNameTag(String name)
      Specified by:
      setNameTag in interface org.cloudburstmc.api.entity.Entity
    • isNameTagVisible

      public boolean isNameTagVisible()
      Specified by:
      isNameTagVisible in interface org.cloudburstmc.api.entity.Entity
    • setNameTagVisible

      public void setNameTagVisible(boolean visible)
      Specified by:
      setNameTagVisible in interface org.cloudburstmc.api.entity.Entity
    • getScale

      public float getScale()
      Specified by:
      getScale in interface org.cloudburstmc.api.entity.Entity
    • setScale

      public void setScale(float scale)
      Specified by:
      setScale in interface org.cloudburstmc.api.entity.Entity
    • getPassengers

      public List<? extends org.cloudburstmc.api.entity.Entity> getPassengers()
      Specified by:
      getPassengers in interface org.cloudburstmc.api.entity.Entity
    • isPassenger

      public boolean isPassenger(org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      isPassenger in interface org.cloudburstmc.api.entity.Entity
    • isControlling

      public boolean isControlling(org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      isControlling in interface org.cloudburstmc.api.entity.Entity
    • hasControllingPassenger

      public boolean hasControllingPassenger()
      Specified by:
      hasControllingPassenger in interface org.cloudburstmc.api.entity.Entity
    • getSeatPosition

      public com.nukkitx.math.vector.Vector3f getSeatPosition()
      Specified by:
      getSeatPosition in interface org.cloudburstmc.api.entity.Entity
    • setSeatPosition

      public void setSeatPosition(com.nukkitx.math.vector.Vector3f pos)
      Specified by:
      setSeatPosition in interface org.cloudburstmc.api.entity.Entity
    • getVehicle

      public org.cloudburstmc.api.entity.Entity getVehicle()
      Specified by:
      getVehicle in interface org.cloudburstmc.api.entity.Entity
    • mount

      public boolean mount(org.cloudburstmc.api.entity.Entity vehicle, org.cloudburstmc.api.util.data.MountType mode)
      Specified by:
      mount in interface org.cloudburstmc.api.entity.Entity
    • dismount

      public boolean dismount(org.cloudburstmc.api.entity.Entity vehicle)
      Specified by:
      dismount in interface org.cloudburstmc.api.entity.Entity
    • onMount

      public void onMount(org.cloudburstmc.api.entity.Entity passenger)
      Specified by:
      onMount in interface org.cloudburstmc.api.entity.Entity
    • onDismount

      public void onDismount(org.cloudburstmc.api.entity.Entity passenger)
      Specified by:
      onDismount in interface org.cloudburstmc.api.entity.Entity
    • getEffects

      public Map<org.cloudburstmc.api.potion.EffectType,​org.cloudburstmc.api.potion.Effect> getEffects()
      Specified by:
      getEffects in interface org.cloudburstmc.api.entity.Entity
    • removeAllEffects

      public void removeAllEffects()
      Specified by:
      removeAllEffects in interface org.cloudburstmc.api.entity.Entity
    • addEffect

      public void addEffect(org.cloudburstmc.api.potion.Effect effect)
      Specified by:
      addEffect in interface org.cloudburstmc.api.entity.Entity
    • getEffect

      public org.cloudburstmc.api.potion.Effect getEffect(int effectId)
      Specified by:
      getEffect in interface org.cloudburstmc.api.entity.Entity
    • getEffect

      public org.cloudburstmc.api.potion.Effect getEffect(org.cloudburstmc.api.potion.EffectType type)
      Specified by:
      getEffect in interface org.cloudburstmc.api.entity.Entity
    • removeEffect

      public void removeEffect(int effectId)
      Specified by:
      removeEffect in interface org.cloudburstmc.api.entity.Entity
    • removeEffect

      public void removeEffect(org.cloudburstmc.api.potion.EffectType type)
      Specified by:
      removeEffect in interface org.cloudburstmc.api.entity.Entity
    • hasEffect

      public boolean hasEffect(int effectId)
      Specified by:
      hasEffect in interface org.cloudburstmc.api.entity.Entity
    • hasEffect

      public boolean hasEffect(org.cloudburstmc.api.potion.EffectType type)
      Specified by:
      hasEffect in interface org.cloudburstmc.api.entity.Entity
    • isOp

      public boolean isOp()
      Specified by:
      isOp in interface org.cloudburstmc.api.player.Player
    • setMovementSpeed

      public void setMovementSpeed(float speed)
      Specified by:
      setMovementSpeed in interface org.cloudburstmc.api.player.Player
    • getMovementSpeed

      public float getMovementSpeed()
      Specified by:
      getMovementSpeed in interface org.cloudburstmc.api.player.Player
    • getLevel

      public org.cloudburstmc.api.level.Level getLevel()
      Specified by:
      getLevel in interface org.cloudburstmc.api.entity.Entity
      Specified by:
      getLevel in interface org.cloudburstmc.api.player.Player
    • isSpectator

      public boolean isSpectator()
      Specified by:
      isSpectator in interface org.cloudburstmc.api.player.Player
    • isCreative

      public boolean isCreative()
      Specified by:
      isCreative in interface org.cloudburstmc.api.player.Player
    • isSurvival

      public boolean isSurvival()
      Specified by:
      isSurvival in interface org.cloudburstmc.api.player.Player
    • resetInAirTicks

      public void resetInAirTicks()
      Specified by:
      resetInAirTicks in interface org.cloudburstmc.api.player.Player
    • isSpawned

      public boolean isSpawned()
      Specified by:
      isSpawned in interface org.cloudburstmc.api.player.Player
    • getGamemode

      public org.cloudburstmc.api.player.GameMode getGamemode()
      Specified by:
      getGamemode in interface org.cloudburstmc.api.player.Player
    • getWindowId

      public byte getWindowId(org.cloudburstmc.api.inventory.Inventory inventory)
      Specified by:
      getWindowId in interface org.cloudburstmc.api.player.Player
    • addWindow

      public byte addWindow(org.cloudburstmc.api.inventory.Inventory window, Byte forceId, boolean isPermanent)
      Specified by:
      addWindow in interface org.cloudburstmc.api.player.Player
    • removeWindow

      public void removeWindow(org.cloudburstmc.api.inventory.Inventory inventory)
      Specified by:
      removeWindow in interface org.cloudburstmc.api.player.Player
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface org.cloudburstmc.api.player.Player
    • getXuid

      public String getXuid()
      Specified by:
      getXuid in interface org.cloudburstmc.api.player.Player
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface org.cloudburstmc.api.player.Player
    • save

      public void save(boolean async)
      Specified by:
      save in interface org.cloudburstmc.api.player.Player
    • getCardinalDirection

      public org.cloudburstmc.api.util.data.CardinalDirection getCardinalDirection()
      Specified by:
      getCardinalDirection in interface org.cloudburstmc.api.player.Player
    • isAdventure

      public boolean isAdventure()
      Specified by:
      isAdventure in interface org.cloudburstmc.api.player.Player
    • getSpawn

      public org.cloudburstmc.api.level.Location getSpawn()
      Specified by:
      getSpawn in interface org.cloudburstmc.api.player.Player
    • setSpawn

      public void setSpawn(org.cloudburstmc.api.level.Location spawn)
      Specified by:
      setSpawn in interface org.cloudburstmc.api.player.Player
    • getSkin

      public org.cloudburstmc.api.player.skin.Skin getSkin()
      Specified by:
      getSkin in interface org.cloudburstmc.api.player.Player
    • setSkin

      public void setSkin(org.cloudburstmc.api.player.skin.Skin newSkin)
      Specified by:
      setSkin in interface org.cloudburstmc.api.player.Player
    • getViewingEnderChest

      public org.cloudburstmc.api.blockentity.EnderChest getViewingEnderChest()
      Specified by:
      getViewingEnderChest in interface org.cloudburstmc.api.player.Player
    • setViewingEnderChest

      public void setViewingEnderChest(org.cloudburstmc.api.blockentity.EnderChest chest)
      Specified by:
      setViewingEnderChest in interface org.cloudburstmc.api.player.Player
    • setOp

      public void setOp(boolean value)
      Specified by:
      setOp in interface org.cloudburstmc.api.player.Player
    • isBanned

      public boolean isBanned()
      Specified by:
      isBanned in interface org.cloudburstmc.api.player.Player
    • setBanned

      public void setBanned(boolean value)
      Specified by:
      setBanned in interface org.cloudburstmc.api.player.Player
    • isWhitelisted

      public boolean isWhitelisted()
      Specified by:
      isWhitelisted in interface org.cloudburstmc.api.player.Player
    • setWhitelisted

      public void setWhitelisted(boolean value)
      Specified by:
      setWhitelisted in interface org.cloudburstmc.api.player.Player
    • getFirstPlayed

      public OptionalLong getFirstPlayed()
      Specified by:
      getFirstPlayed in interface org.cloudburstmc.api.player.Player
    • getLastPlayed

      public OptionalLong getLastPlayed()
      Specified by:
      getLastPlayed in interface org.cloudburstmc.api.player.Player
    • hasPlayedBefore

      public boolean hasPlayedBefore()
      Specified by:
      hasPlayedBefore in interface org.cloudburstmc.api.player.Player
    • isInsideOfWater

      public boolean isInsideOfWater()
      Specified by:
      isInsideOfWater in interface org.cloudburstmc.api.player.Player
    • isSneaking

      public boolean isSneaking()
      Specified by:
      isSneaking in interface org.cloudburstmc.api.player.Player
    • isSleeping

      public boolean isSleeping()
      Specified by:
      isSleeping in interface org.cloudburstmc.api.player.Player
    • sleepOn

      public boolean sleepOn(com.nukkitx.math.vector.Vector3i pos)
      Specified by:
      sleepOn in interface org.cloudburstmc.api.player.Player
    • stopSleep

      public void stopSleep()
      Specified by:
      stopSleep in interface org.cloudburstmc.api.player.Player
    • isOnGround

      public boolean isOnGround()
      Specified by:
      isOnGround in interface org.cloudburstmc.api.entity.Entity
      Specified by:
      isOnGround in interface org.cloudburstmc.api.player.Player
    • getInventory

      public org.cloudburstmc.api.inventory.PlayerInventory getInventory()
      Specified by:
      getInventory in interface org.cloudburstmc.api.inventory.InventoryHolder
      Specified by:
      getInventory in interface org.cloudburstmc.api.player.Player
    • getEnderChestInventory

      public org.cloudburstmc.api.inventory.ContainerInventory getEnderChestInventory()
      Specified by:
      getEnderChestInventory in interface org.cloudburstmc.api.player.Player
    • getCraftingInventory

      public org.cloudburstmc.api.inventory.CraftingGrid getCraftingInventory()
      Specified by:
      getCraftingInventory in interface org.cloudburstmc.api.player.Player
    • setOnGround

      public void setOnGround(boolean onGround)
      Specified by:
      setOnGround in interface org.cloudburstmc.api.entity.Entity
    • kill

      public void kill()
      Specified by:
      kill in interface org.cloudburstmc.api.entity.Entity
    • teleport

      public boolean teleport(com.nukkitx.math.vector.Vector3f pos, org.cloudburstmc.api.event.player.PlayerTeleportEvent.TeleportCause cause)
      Specified by:
      teleport in interface org.cloudburstmc.api.entity.Entity
    • teleport

      public boolean teleport(org.cloudburstmc.api.level.Location location, org.cloudburstmc.api.event.player.PlayerTeleportEvent.TeleportCause cause)
      Specified by:
      teleport in interface org.cloudburstmc.api.entity.Entity
    • getOwner

      @Nullable public org.cloudburstmc.api.entity.Entity getOwner()
      Specified by:
      getOwner in interface org.cloudburstmc.api.entity.Entity
    • setOwner

      public void setOwner(@Nullable org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      setOwner in interface org.cloudburstmc.api.entity.Entity
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface org.cloudburstmc.api.entity.Entity
    • close

      public void close()
      Specified by:
      close in interface org.cloudburstmc.api.entity.Entity