public abstract class AbstractProxyPlayer extends AbstractEntity implements Player
Constructor and Description |
---|
AbstractProxyPlayer() |
Modifier and Type | Method and Description |
---|---|
void |
addPotionEffect(PotionEffectType type,
int duration,
int amplifier) |
void |
closeInventory() |
void |
damage(double amount)
Damage player according to damage amount
|
boolean |
equals(Object obj) |
List<PotionEffect> |
getActivePotionEffect() |
boolean |
getAllowFlight()
Check if the player is authorized to fly
|
BoundingBox |
getBoundingBox()
Get the bounding box of the current entity
|
String |
getEntityId()
Get the entity ID
|
double |
getEyeHeight() |
Location |
getEyeLocation() |
float |
getFallDistance()
Get the player fall distance when player fall
|
float |
getFlySpeed()
Get player fly speed
|
int |
getFoodLevel()
Get the current player food level
|
GameMode |
getGameMode()
Get player gamemode
|
double |
getHealth()
Get the player health
|
PlayerInventory |
getInventory() |
ItemStack |
getItemInHand()
Get the item in main hand
Return null if there is not any item in hand
|
ItemStack |
getItemInOffHand()
Get the item in second hand
Compatible with 1.8 and lower.
|
int |
getLevel()
Get player XP level
|
double |
getMaxHealth()
Get the max player health
|
List<Entity> |
getNearbyEntities(double x,
double y,
double z) |
Inventory |
getOpenInventory() |
Optional<PotionEffect> |
getPotionEffect(PotionEffectType type) |
Vector |
getRotation()
Get the rotation (also called "direction") of the entity
|
Vector |
getTheoricVelocity()
Get the velocity that the entity SHOULD be take
|
Entity |
getVehicle()
Get the entity which is used as vehicle.
|
Vector |
getVelocity()
Get current entity velocity
|
float |
getWalkSpeed()
Get player walk speed
|
World |
getWorld()
Get player world
|
boolean |
hasElytra()
Check if the player is using elytra (flying with it)
(compatible with 1.8 and lower)
|
boolean |
hasLineOfSight(Entity entity)
Check if player can see the specified entity
|
boolean |
hasOpenInventory() |
boolean |
hasPotionEffect(PotionEffectType type) |
boolean |
isDead()
Know if the player is dead
|
boolean |
isFlying()
Check if the player is flying
|
boolean |
isInsideVehicle()
Check if player is in a vehicle.
|
boolean |
isSleeping()
Know if the player is sleeping
|
boolean |
isSneaking() |
boolean |
isSprinting() |
boolean |
isSwimming()
Know if the player is swimming
(compatible with 1.8 and lower)
|
boolean |
isUsingRiptide()
Know if the player is currently using riptide effect
(compatible with 1.12 and lower)
|
void |
openInventory(Inventory inv) |
void |
removePotionEffect(PotionEffectType type) |
void |
setAllowFlight(boolean b)
Edit the authorization to fly
|
void |
setFoodLevel(int foodlevel)
Change the food level
|
void |
setGameMode(GameMode gameMode)
Set the player gamemode
Warn: support only default gamemode.
|
void |
setHealth(double health)
Change the player health
|
void |
setPlayerVersion(Version version) |
void |
setProtocolVersion(int protocolVersion) |
void |
setSneaking(boolean b) |
void |
setSprinting(boolean b) |
void |
setVanished(boolean vanished)
Sets whether the play should be visible to other players.
|
void |
setVelocity(Vector vel)
Edit the entity velocity
|
void |
teleport(Entity et)
Teleport player to specified entity
|
void |
teleport(Location loc)
Teleport player to specified location
|
void |
updateInventory() |
applyTheoricVelocity, getTargetBlock, toString
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPotionEffect, getAddress, getIP, getPing, getPlayerVersion, getProtocolVersion, getServerName, hasPermission, hasPlayedBefore, hasThorns, isInBoat, isSamePlayer, kick, queuePacket, sendPacket, sendPluginMessage, sendPluginMessage, sendToServer
getLocation, getType, getUniqueId, isOnGround, isOnline, sendMessage
applyTheoricVelocity, getTargetBlock, isOp, isSameId, isSameId
getName
getDefault
public boolean isDead()
Player
public boolean isSleeping()
Player
isSleeping
in interface Player
public boolean isSwimming()
Player
isSwimming
in interface Player
public boolean isUsingRiptide()
Player
isUsingRiptide
in interface Player
public boolean hasElytra()
Player
public boolean getAllowFlight()
Player
getAllowFlight
in interface Player
public boolean hasLineOfSight(Entity entity)
Player
hasLineOfSight
in interface Player
entity
- the entity to seepublic boolean isFlying()
Player
public void setAllowFlight(boolean b)
Player
setAllowFlight
in interface Player
b
- true if the player is allowed to flypublic int getLevel()
Player
public int getFoodLevel()
Player
getFoodLevel
in interface Player
public void setFoodLevel(int foodlevel)
Player
setFoodLevel
in interface Player
foodlevel
- the new food levelpublic float getFlySpeed()
Player
getFlySpeed
in interface Player
public float getWalkSpeed()
Player
getWalkSpeed
in interface Player
public float getFallDistance()
Player
getFallDistance
in interface Player
public double getHealth()
Player
public double getMaxHealth()
Player
getMaxHealth
in interface Player
public void setHealth(double health)
Player
public GameMode getGameMode()
Player
getGameMode
in interface Player
public void setGameMode(GameMode gameMode)
Player
setGameMode
in interface Player
gameMode
- the new player gamemodepublic void damage(double amount)
Player
public void teleport(Location loc)
Player
public void teleport(Entity et)
Player
public boolean isSneaking()
isSneaking
in interface Player
public void setSneaking(boolean b)
setSneaking
in interface Player
public boolean isSprinting()
isSprinting
in interface Player
public void setSprinting(boolean b)
setSprinting
in interface Player
public Entity getVehicle()
Player
getVehicle
in interface Player
public boolean isInsideVehicle()
Player
isInsideVehicle
in interface Player
public ItemStack getItemInHand()
Player
getItemInHand
in interface Player
public ItemStack getItemInOffHand()
Player
getItemInOffHand
in interface Player
public boolean hasPotionEffect(PotionEffectType type)
hasPotionEffect
in interface Player
public List<PotionEffect> getActivePotionEffect()
getActivePotionEffect
in interface Player
public Optional<PotionEffect> getPotionEffect(PotionEffectType type)
getPotionEffect
in interface Player
public void addPotionEffect(PotionEffectType type, int duration, int amplifier)
addPotionEffect
in interface Player
public void removePotionEffect(PotionEffectType type)
removePotionEffect
in interface Player
public List<Entity> getNearbyEntities(double x, double y, double z)
getNearbyEntities
in interface Player
public PlayerInventory getInventory()
getInventory
in interface Player
public Inventory getOpenInventory()
getOpenInventory
in interface Player
public boolean hasOpenInventory()
hasOpenInventory
in interface Player
public void openInventory(Inventory inv)
openInventory
in interface Player
public void closeInventory()
closeInventory
in interface Player
public void updateInventory()
updateInventory
in interface Player
public void setVanished(boolean vanished)
Player
setVanished
in interface Player
vanished
- true is the player should NOT be visiblepublic Vector getVelocity()
Entity
getVelocity
in interface Entity
getVelocity
in interface OfflinePlayer
getVelocity
in class AbstractEntity
public void setVelocity(Vector vel)
Entity
setVelocity
in interface Entity
setVelocity
in interface OfflinePlayer
vel
- the new velocitypublic double getEyeHeight()
getEyeHeight
in interface Entity
getEyeHeight
in interface OfflinePlayer
public Location getEyeLocation()
getEyeLocation
in interface Entity
getEyeLocation
in interface OfflinePlayer
public Vector getRotation()
Entity
getRotation
in interface Entity
getRotation
in interface OfflinePlayer
public String getEntityId()
Entity
getEntityId
in interface Entity
getEntityId
in interface OfflinePlayer
public BoundingBox getBoundingBox()
Entity
getBoundingBox
in interface Entity
getBoundingBox
in interface OfflinePlayer
public Vector getTheoricVelocity()
Entity
getTheoricVelocity
in interface Entity
getTheoricVelocity
in interface OfflinePlayer
public void setPlayerVersion(Version version)
setPlayerVersion
in interface Player
public void setProtocolVersion(int protocolVersion)
setProtocolVersion
in interface Player