public class CompensatedPlayer extends AbstractPlayer
location, playerVersion, protocolVersion, velocity| Constructor and Description |
|---|
CompensatedPlayer(int entityId,
UUID uuid,
CompensatedWorld world) |
| 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
|
List<PotionEffect> |
getActivePotionEffect() |
InetSocketAddress |
getAddress()
Get the player address
|
boolean |
getAllowFlight()
Check if the player is authorized to fly
|
BoundingBox |
getBoundingBox()
Get the bounding box of the current entity
|
Object |
getDefault()
Get default object which is abstracted by Negativity structure.
|
int |
getEntityId()
Get the entity ID
|
double |
getEyeHeight() |
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() |
@Nullable String |
getIP()
Get the player IP
|
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
|
String |
getName() |
List<Entity> |
getNearbyEntities(double x,
double y,
double z) |
Inventory |
getOpenInventory() |
int |
getPing()
Get current player latency
|
Optional<PotionEffect> |
getPotionEffect(PotionEffectType type) |
String |
getServerName()
Get the name of the server where the player is actually
|
Vector |
getTheoricVelocity()
Get the velocity that the entity SHOULD be take
|
UUID |
getUniqueId() |
Entity |
getVehicle()
Get the entity which is used as vehicle.
|
float |
getWalkSpeed()
Get player walk speed
|
CompensatedWorld |
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 |
hasPermission(String perm)
Check if the player has the specified permission
|
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 |
isOnline() |
boolean |
isOp()
Check if the actual entity is OP or not
|
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 |
kick(String reason)
Kick player with the specified reason
|
void |
openInventory(Inventory inv) |
void |
removePotionEffect(PotionEffectType type) |
void |
sendPluginMessage(String channelId,
byte[] writeMessage)
Send plugin message :
bungee to spigot
OR
spigot to bungee
On the specified channel
|
void |
sendToServer(String serverName)
Send current player to the given server name.
|
void |
setAllowFlight(boolean b)
Edit the authorization to fly
|
void |
setFlying(boolean b) |
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 |
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 |
setWorld(CompensatedWorld world) |
void |
teleport(Entity et)
Teleport player to specified entity
|
void |
teleport(Location loc)
Teleport player to specified location
|
String |
toString() |
void |
updateInventory() |
applyTheoricVelocity, equals, getLocation, getPlayerVersion, getProtocolVersion, getTargetBlock, getVelocity, init, setInternalWorld, setLocation, setPlayerVersion, setProtocolVersionclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPotionEffect, hasPlayedBefore, hasThorns, isInBoat, isSamePlayer, queuePacket, sendPacket, sendPluginMessage, setSleepinggetType, isOnGround, sendMessagegetEyeLocation, getRotation, isSameId, isSameId, isSameIdpublic CompensatedPlayer(int entityId,
UUID uuid,
CompensatedWorld world)
public double getEyeHeight()
public CompensatedWorld getWorld()
PlayergetWorld in interface EntitygetWorld in interface OfflinePlayergetWorld in interface PlayergetWorld in class AbstractPlayerpublic void setWorld(CompensatedWorld world)
public int getEntityId()
Entitypublic @Nullable String getIP()
Playerpublic boolean isDead()
Playerpublic boolean isSleeping()
Playerpublic boolean isSwimming()
Playerpublic boolean isUsingRiptide()
Playerpublic boolean hasElytra()
Playerpublic boolean hasPermission(String perm)
Playerperm - the needed permissionpublic boolean hasLineOfSight(Entity entity)
Playerentity - the entity to seepublic boolean isFlying()
Playerpublic void setFlying(boolean b)
public boolean getAllowFlight()
Playerpublic void setAllowFlight(boolean b)
Playerb - true if the player is allowed to flypublic int getPing()
Playerpublic int getLevel()
Playerpublic float getFlySpeed()
Playerpublic float getWalkSpeed()
Playerpublic float getFallDistance()
Playerpublic double getHealth()
Playerpublic double getMaxHealth()
Playerpublic void setHealth(double health)
Playerhealth - next healthpublic int getFoodLevel()
Playerpublic void setFoodLevel(int foodlevel)
Playerfoodlevel - the new food levelpublic GameMode getGameMode()
Playerpublic void setGameMode(GameMode gameMode)
PlayergameMode - the new player gamemodepublic void damage(double amount)
Playeramount - the quantity of damagepublic void kick(String reason)
Playerreason - the reason of kickpublic void teleport(Location loc)
Playerloc - location destinationpublic void teleport(Entity et)
Playeret - entity destinationpublic boolean isSneaking()
public void setSneaking(boolean b)
public boolean isSprinting()
public void setSprinting(boolean b)
public Vector getTheoricVelocity()
Playerpublic void setVelocity(Vector vel)
Playervel - the new velocitypublic Entity getVehicle()
Playerpublic boolean isInsideVehicle()
Playerpublic ItemStack getItemInHand()
Playerpublic ItemStack getItemInOffHand()
Playerpublic boolean hasPotionEffect(PotionEffectType type)
public List<PotionEffect> getActivePotionEffect()
public Optional<PotionEffect> getPotionEffect(PotionEffectType type)
public void addPotionEffect(PotionEffectType type, int duration, int amplifier)
public void removePotionEffect(PotionEffectType type)
public void sendPluginMessage(String channelId, byte[] writeMessage)
PlayerchannelId - the channel IDwriteMessage - the message to sentpublic PlayerInventory getInventory()
public Inventory getOpenInventory()
public boolean hasOpenInventory()
public void openInventory(Inventory inv)
public void closeInventory()
public void updateInventory()
public void setVanished(boolean vanished)
Playervanished - true is the player should NOT be visiblepublic InetSocketAddress getAddress()
Playerpublic void sendToServer(String serverName)
PlayerserverName - the name of the proxy serverpublic String getServerName()
Playerpublic UUID getUniqueId()
public boolean isOnline()
public boolean isOp()
Entitypublic BoundingBox getBoundingBox()
Entitypublic String getName()
public Object getDefault()
NegativityObject
For example, when we use World, beside there is the Spigot/Sponge... world.
We can get the default platform object, in the example, the platform world.