public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, NetworkClient
Modifier and Type | Interface and Description |
---|---|
static class |
Player.Spigot |
Modifier and Type | Method and Description |
---|---|
int |
applyMending(int amount)
Applies the mending effect to any items just as picking up an orb would.
|
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> |
asHoverEvent(UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) |
default @Nullable BanEntry |
banPlayerFull(@Nullable String reason)
Permanently Bans the Profile and IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerFull(@Nullable String reason,
@Nullable Date expires)
Bans the Profile and IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerFull(@Nullable String reason,
@Nullable Date expires,
@Nullable String source)
Bans the Profile and IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerFull(@Nullable String reason,
@Nullable String source)
Permanently Bans the Profile and IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason)
Permanently Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
boolean kickPlayer)
Permanently Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable Date expires)
Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable Date expires,
boolean kickPlayer)
Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable Date expires,
@Nullable String source)
Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable Date expires,
@Nullable String source,
boolean kickPlayer)
Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable String source)
Permanently Bans the IP address currently used by the player.
|
default @Nullable BanEntry |
banPlayerIP(@Nullable String reason,
@Nullable String source,
boolean kickPlayer)
Permanently Bans the IP address currently used by the player.
|
@Nullable Firework |
boostElytra(@NotNull ItemStack firework)
Boost a Player that's
LivingEntity.isGliding() using a Firework . |
boolean |
canSee(@NotNull Player player)
Checks to see if a player has been hidden from this player
|
void |
chat(@NotNull String msg)
Says a message (or runs a command).
|
net.kyori.adventure.text.Component |
displayName()
Gets the "friendly" name to display of this player.
|
void |
displayName(net.kyori.adventure.text.Component displayName)
Sets the "friendly" name to display of this player.
|
@Nullable InetSocketAddress |
getAddress()
Gets the socket address of this player
|
@NotNull AdvancementProgress |
getAdvancementProgress(@NotNull Advancement advancement)
Return the player's progression on the specified advancement.
|
boolean |
getAffectsSpawning()
Get whether the player can affect mob spawning
|
boolean |
getAllowFlight()
Determines if the Player is allowed to fly via jump key double-tap like
in creative mode.
|
@Nullable Location |
getBedSpawnLocation()
Gets the Location where the player will spawn at their bed, null if
they have not slept in one or their current bed spawn is invalid.
|
@Nullable String |
getClientBrandName()
Returns player's client brand name.
|
<T> T |
getClientOption(@NotNull ClientOption<T> option) |
int |
getClientViewDistance()
Get the player's current client side view distance.
|
@NotNull Location |
getCompassTarget()
Get the previously set compass target.
|
float |
getCooldownPeriod()
Returns the amount of ticks the current cooldown lasts
|
float |
getCooledAttackStrength(float adjustTicks)
Returns the percentage of attack power available based on the cooldown (zero to one).
|
@NotNull String |
getDisplayName()
Deprecated.
in favour of
displayName() |
float |
getExp()
Gets the players current experience points towards the next level.
|
float |
getFlySpeed()
Gets the current allowed speed that a client can fly.
|
double |
getHealthScale()
Gets the number that health is scaled to for the client.
|
int |
getLevel()
Gets the players current experience level
|
@NotNull String |
getLocale()
Deprecated.
in favour of
locale() |
int |
getPing()
Gets the player's estimated ping in milliseconds.
|
@Nullable String |
getPlayerListFooter()
Deprecated.
in favour of
playerListFooter() |
@Nullable String |
getPlayerListHeader()
Deprecated.
in favour of
playerListHeader() |
@NotNull String |
getPlayerListName()
Deprecated.
in favour of
playerListName() |
@NotNull PlayerProfile |
getPlayerProfile()
Gets a copy of this players profile
|
long |
getPlayerTime()
Returns the player's current timestamp.
|
long |
getPlayerTimeOffset()
Returns the player's current time offset relative to server time, or
the current player's fixed time if the player's time is absolute.
|
@Nullable WeatherType |
getPlayerWeather()
Returns the type of weather the player is currently experiencing.
|
@Nullable String |
getResourcePackHash()
Deprecated.
This is no longer sent from the client and will always be null
|
PlayerResourcePackStatusEvent.Status |
getResourcePackStatus() |
@NotNull Scoreboard |
getScoreboard()
Gets the Scoreboard displayed to this player
|
@Nullable Entity |
getSpectatorTarget()
Gets the entity which is followed by the camera when in
GameMode.SPECTATOR . |
int |
getTotalExperience()
Gets the players total experience points.
|
@NotNull Set<Player> |
getTrackedPlayers() |
int |
getViewDistance()
Deprecated.
This is unimplemented and will throw an exception at runtime. The
World -based methods still work. |
float |
getWalkSpeed()
Gets the current allowed speed that a client can walk.
|
default void |
giveExp(int amount)
Gives the player the amount of experience specified.
|
void |
giveExp(int amount,
boolean applyMending)
Gives the player the amount of experience specified.
|
void |
giveExpLevels(int amount)
Gives the player the amount of experience levels specified.
|
boolean |
hasResourcePack() |
void |
hidePlayer(@NotNull Player player)
Deprecated.
|
void |
hidePlayer(@NotNull Plugin plugin,
@NotNull Player player)
Hides a player from this player
|
void |
hideTitle()
Deprecated.
use
Audience.clearTitle() |
default net.kyori.adventure.identity.Identity |
identity() |
boolean |
isFlying()
Checks to see if this player is currently flying or not.
|
boolean |
isHealthScaled()
Gets if the client is displayed a 'scaled' health, that is, health on a
scale from 0-
getHealthScale() . |
boolean |
isOnGround()
Deprecated.
This value is controlled only by the client and is therefore
unreliable and vulnerable to spoofing and/or desync depending on the
context/time which it is accessed
|
boolean |
isPlayerTimeRelative()
Returns true if the player's time is relative to the server time,
otherwise the player's time is absolute and will not change its current
time unless done so with setPlayerTime().
|
boolean |
isSleepingIgnored()
Returns whether the player is sleeping ignored.
|
boolean |
isSneaking()
Returns if the player is in sneak mode
|
boolean |
isSprinting()
Gets whether the player is sprinting or not.
|
void |
kick(net.kyori.adventure.text.Component message)
Kicks player with custom kick message.
|
void |
kickPlayer(@Nullable String message)
Deprecated.
in favour of
kick(net.kyori.adventure.text.Component) |
void |
loadData()
Loads the players current location, health, inventory, motion, and
other information from the username.dat file, in the world/player
folder.
|
Locale |
locale()
Gets the player's current locale.
|
void |
openBook(@NotNull ItemStack book)
Open a
Material.WRITTEN_BOOK for a Player |
boolean |
performCommand(@NotNull String command)
Makes the player perform the given command
|
void |
playAnimationToSelf(@NotNull EntityAnimation animation)
Plays an animation to the player itself.
|
void |
playEffect(@NotNull Location loc,
@NotNull Effect effect,
int data)
Deprecated.
Magic value
|
<T> void |
playEffect(@NotNull Location loc,
@NotNull Effect effect,
T data)
Plays an effect to just this player.
|
net.kyori.adventure.text.Component |
playerListFooter()
Gets the currently displayed player list footer for this player.
|
net.kyori.adventure.text.Component |
playerListHeader()
Gets the currently displayed player list header for this player.
|
net.kyori.adventure.text.Component |
playerListName()
Gets the name that is shown on the in-game player list.
|
void |
playerListName(net.kyori.adventure.text.Component name)
Sets the name that is shown on the in-game player list.
|
void |
playNote(@NotNull Location loc,
byte instrument,
byte note)
Deprecated.
Magic value
|
void |
playNote(@NotNull Location loc,
@NotNull Instrument instrument,
@NotNull Note note)
Play a note for a player at a location.
|
void |
playSound(@NotNull Location location,
@NotNull Sound sound,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
playSound(@NotNull Location location,
@NotNull Sound sound,
@NotNull SoundCategory category,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
playSound(@NotNull Location location,
@NotNull String sound,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
playSound(@NotNull Location location,
@NotNull String sound,
@NotNull SoundCategory category,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
resetCooldown()
Reset the cooldown counter to 0, effectively starting the cooldown period.
|
void |
resetPlayerTime()
Restores the normal condition where the player's time is synchronized
with the server time.
|
void |
resetPlayerWeather()
Restores the normal condition where the player's weather is controlled
by server conditions.
|
void |
resetTitle()
Resets the title displayed to the player.
|
void |
saveData()
Saves the players current location, health, inventory, motion, and
other information into the username.dat file, in the world/player
folder
|
void |
sendActionBar(BaseComponent... message)
Deprecated.
use
Audience.sendActionBar(Component) |
void |
sendActionBar(char alternateChar,
@NotNull String message)
Deprecated.
use
Audience.sendActionBar(Component) |
void |
sendActionBar(@NotNull String message)
Deprecated.
use
Audience.sendActionBar(Component) |
void |
sendBlockChange(@NotNull Location loc,
@NotNull BlockData block)
Send a block change.
|
void |
sendBlockChange(@NotNull Location loc,
@NotNull Material material,
byte data)
Deprecated.
Magic value
|
void |
sendBlockDamage(@NotNull Location loc,
float progress)
Send block damage.
|
boolean |
sendChunkChange(@NotNull Location loc,
int sx,
int sy,
int sz,
@NotNull byte[] data)
Deprecated.
Magic value
|
void |
sendExperienceChange(float progress)
Send an experience change.
|
void |
sendExperienceChange(float progress,
int level)
Send an experience change.
|
void |
sendMap(@NotNull MapView map)
Render a map and send it to the player in its entirety.
|
default void |
sendMessage(BaseComponent... components)
Deprecated.
use
sendMessage methods that accept Component |
default void |
sendMessage(BaseComponent component)
Deprecated.
use
sendMessage methods that accept Component |
default void |
sendMessage(ChatMessageType position,
BaseComponent... components)
Deprecated.
This is unlikely the API you want to use. See
sendActionBar(String) for a more proper Action Bar API. This deprecated API may send unsafe items to the client. |
void |
sendOpLevel(byte level)
Send a packet to the player indicating its operator status level.
|
void |
sendRawMessage(@NotNull String message)
Sends this sender a message raw
|
void |
sendSignChange(@NotNull Location loc,
List<net.kyori.adventure.text.Component> lines)
Send a sign change.
|
void |
sendSignChange(@NotNull Location loc,
List<net.kyori.adventure.text.Component> lines,
@NotNull DyeColor dyeColor)
Send a sign change.
|
void |
sendSignChange(@NotNull Location loc,
@Nullable String[] lines)
Deprecated.
in favour of
sendSignChange(org.bukkit.Location, java.util.List) |
void |
sendSignChange(@NotNull Location loc,
@Nullable String[] lines,
@NotNull DyeColor dyeColor)
Deprecated.
|
void |
sendTitle(@Nullable String title,
@Nullable String subtitle)
Deprecated.
API behavior subject to change
|
void |
sendTitle(@Nullable String title,
@Nullable String subtitle,
int fadeIn,
int stay,
int fadeOut)
Sends a title and a subtitle message to the player.
|
void |
sendTitle(@NotNull Title title)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
setAffectsSpawning(boolean affects)
Set whether the player can affect mob spawning
|
void |
setAllowFlight(boolean flight)
Sets if the Player is allowed to fly via jump key double-tap like in
creative mode.
|
void |
setBedSpawnLocation(@Nullable Location location)
Sets the Location where the player will spawn at their bed.
|
void |
setBedSpawnLocation(@Nullable Location location,
boolean force)
Sets the Location where the player will spawn at their bed.
|
void |
setCompassTarget(@NotNull Location loc)
Set the target of the player's compass.
|
void |
setDisplayName(@Nullable String name)
Deprecated.
in favour of
displayName(net.kyori.adventure.text.Component) |
void |
setExp(float exp)
Sets the players current experience points towards the next level
|
void |
setFlying(boolean value)
Makes this player start or stop flying.
|
void |
setFlySpeed(float value)
Sets the speed at which a client will fly.
|
void |
setHealthScale(double scale)
Sets the number to scale health to for the client; this will also
setHealthScaled(true) . |
void |
setHealthScaled(boolean scale)
Sets if the client is displayed a 'scaled' health, that is, health on a
scale from 0-
getHealthScale() . |
void |
setLevel(int level)
Sets the players current experience level
|
void |
setPlayerListFooter(@Nullable String footer)
Deprecated.
in favour of
Audience.sendPlayerListFooter(net.kyori.adventure.text.Component) |
void |
setPlayerListHeader(@Nullable String header)
Deprecated.
in favour of
Audience.sendPlayerListHeader(net.kyori.adventure.text.Component) |
void |
setPlayerListHeaderFooter(BaseComponent[] header,
BaseComponent[] footer)
Deprecated.
in favour of
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component) |
void |
setPlayerListHeaderFooter(BaseComponent header,
BaseComponent footer)
Deprecated.
in favour of
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component) |
void |
setPlayerListHeaderFooter(@Nullable String header,
@Nullable String footer)
Deprecated.
in favour of
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component) |
void |
setPlayerListName(@Nullable String name)
Deprecated.
in favour of
playerListName(net.kyori.adventure.text.Component) |
void |
setPlayerProfile(@NotNull PlayerProfile profile)
Changes the PlayerProfile for this player.
|
void |
setPlayerTime(long time,
boolean relative)
Sets the current time on the player's client.
|
void |
setPlayerWeather(@NotNull WeatherType type)
Sets the type of weather the player will see.
|
void |
setResourcePack(@NotNull String url)
Deprecated.
|
void |
setResourcePack(@NotNull String url,
@NotNull byte[] hash)
Request that the player's client download and switch resource packs.
|
void |
setResourcePack(@NotNull String url,
@NotNull String hash)
Request that the player's client download and switch resource packs.
|
void |
setScoreboard(@NotNull Scoreboard scoreboard)
Sets the player's visible Scoreboard.
|
void |
setSleepingIgnored(boolean isSleeping)
Sets whether the player is ignored as not sleeping.
|
void |
setSneaking(boolean sneak)
Sets the sneak mode the player
|
void |
setSpectatorTarget(@Nullable Entity entity)
Sets the entity which is followed by the camera when in
GameMode.SPECTATOR . |
void |
setSprinting(boolean sprinting)
Sets whether the player is sprinting or not.
|
void |
setSubtitle(BaseComponent subtitle)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
setSubtitle(BaseComponent[] subtitle)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
setTexturePack(@NotNull String url)
Deprecated.
Minecraft no longer uses textures packs. Instead you
should use
setResourcePack(String) . |
void |
setTitleTimes(int fadeInTicks,
int stayTicks,
int fadeOutTicks)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
setTotalExperience(int exp)
Sets the players current experience points.
|
void |
setViewDistance(int viewDistance)
Deprecated.
This is unimplemented and will throw an exception at runtime. The
World -based methods still work. |
void |
setWalkSpeed(float value)
Sets the speed at which a client will walk.
|
void |
showPlayer(@NotNull Player player)
Deprecated.
|
void |
showPlayer(@NotNull Plugin plugin,
@NotNull Player player)
Allows this player to see a player that was previously hidden.
|
void |
showTitle(BaseComponent title)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
showTitle(BaseComponent[] title)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
showTitle(BaseComponent[] title,
BaseComponent[] subtitle,
int fadeInTicks,
int stayTicks,
int fadeOutTicks)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
showTitle(BaseComponent title,
BaseComponent subtitle,
int fadeInTicks,
int stayTicks,
int fadeOutTicks)
Deprecated.
Use
Audience.showTitle(net.kyori.adventure.title.Title) |
void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
double x,
double y,
double z,
int count,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count,
double offsetX,
double offsetY,
double offsetZ)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(@NotNull Particle particle,
@NotNull Location location,
int count,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
@NotNull Player.Spigot |
spigot() |
void |
stopSound(@NotNull Sound sound)
Stop the specified sound from playing.
|
void |
stopSound(@NotNull Sound sound,
@Nullable SoundCategory category)
Stop the specified sound from playing.
|
void |
stopSound(@NotNull String sound)
Stop the specified sound from playing.
|
void |
stopSound(@NotNull String sound,
@Nullable SoundCategory category)
Stop the specified sound from playing.
|
void |
updateCommands()
Update the list of commands sent to the client.
|
void |
updateInventory()
Forces an update of the player's entire inventory.
|
void |
updateTitle(@NotNull Title title)
Deprecated.
use
Audience.showTitle(net.kyori.adventure.title.Title) |
closeInventory, closeInventory, discoverRecipe, discoverRecipes, dropItem, getAttackCooldown, getBedLocation, getCooldown, getDiscoveredRecipes, getEnderChest, getExhaustion, getExpToLevel, getFoodLevel, getGameMode, getInventory, getItemInHand, getItemOnCursor, getMainHand, getName, getOpenInventory, getPotentialBedLocation, getSaturatedRegenRate, getSaturation, getShoulderEntityLeft, getShoulderEntityRight, getSleepTicks, getStarvationRate, getUnsaturatedRegenRate, hasCooldown, hasDiscoveredRecipe, isBlocking, isDeeplySleeping, isHandRaised, openAnvil, openCartographyTable, openEnchanting, openGrindstone, openInventory, openInventory, openLoom, openMerchant, openMerchant, openSign, openSmithingTable, openStonecutter, openWorkbench, releaseLeftShoulderEntity, releaseRightShoulderEntity, setCooldown, setExhaustion, setFoodLevel, setGameMode, setItemInHand, setItemOnCursor, setSaturatedRegenRate, setSaturation, setShoulderEntityLeft, setShoulderEntityRight, setStarvationRate, setUnsaturatedRegenRate, setWindowProperty, sleep, undiscoverRecipe, undiscoverRecipes, wakeup
addPotionEffect, addPotionEffect, addPotionEffects, attack, clearActiveItem, getActiveItem, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getArrowsStuck, getCanPickupItems, getCategory, getCollidableExemptions, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getHandRaisedTime, getHurtDirection, getItemUseRemainingTime, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getShieldBlockingDelay, getTargetBlock, getTargetBlock, getTargetBlock, getTargetBlockExact, getTargetBlockExact, getTargetBlockFace, getTargetBlockFace, getTargetBlockInfo, getTargetBlockInfo, getTargetEntity, getTargetEntity, getTargetEntityInfo, getTargetEntityInfo, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isInvisible, isJumping, isLeashed, isRiptiding, isSleeping, isSwimming, playAnimation, playPickupItemAnimation, playPickupItemAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setArrowsStuck, setCanPickupItems, setCollidable, setGliding, setHurtDirection, setInvisible, setJumping, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setShieldBlockingDelay, setSwimming, swingMainHand, swingOffHand
getAttribute, registerAttribute
damage, damage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
addPassenger, addScoreboardTag, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInBubbleColumn, isInLava, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isPersistent, isSilent, isTicking, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync
getMetadata, hasMetadata, removeMetadata, setMetadata
sendMessage, sendMessage, sendMessage, sendMessage, sendMessage
audience, audience, clearTitle, empty, hideBossBar, openBook, openBook, playSound, playSound, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound, toAudience
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
customName, customName, getCustomName, setCustomName
getPersistentDataContainer
asHoverEvent, unbox
launchProjectile, launchProjectile
abandonConversation, abandonConversation, acceptConversationInput, beginConversation, isConversing, sendRawMessage
banPlayer, banPlayer, banPlayer, banPlayer, banPlayer, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, getFirstPlayed, getLastLogin, getLastPlayed, getLastSeen, getName, getPlayer, getStatistic, getStatistic, getStatistic, getUniqueId, hasPlayedBefore, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, isBanned, isOnline, isWhitelisted, setStatistic, setStatistic, setStatistic, setWhitelisted
serialize
getListeningPluginChannels, sendPluginMessage
getProtocolVersion, getVirtualHost
@NotNull default net.kyori.adventure.identity.Identity identity()
identity
in interface net.kyori.adventure.identity.Identified
@NotNull net.kyori.adventure.text.Component displayName()
void displayName(@Nullable net.kyori.adventure.text.Component displayName)
displayName
- the display name to set@Deprecated @NotNull @NotNull String getDisplayName()
displayName()
Note that this name will not be displayed in game, only in chat and places defined by plugins.
@Deprecated void setDisplayName(@Nullable @Nullable String name)
displayName(net.kyori.adventure.text.Component)
Note that this name will not be displayed in game, only in chat and places defined by plugins.
name
- The new display name.void playerListName(@Nullable net.kyori.adventure.text.Component name)
If the value is null, the name will be identical to HumanEntity.getName()
.
name
- new player list name@Nullable net.kyori.adventure.text.Component playerListName()
@Nullable net.kyori.adventure.text.Component playerListHeader()
@Nullable net.kyori.adventure.text.Component playerListFooter()
@NotNull @Deprecated @NotNull String getPlayerListName()
playerListName()
@Deprecated void setPlayerListName(@Nullable @Nullable String name)
playerListName(net.kyori.adventure.text.Component)
If the value is null, the name will be identical to HumanEntity.getName()
.
name
- new player list name@Deprecated @Nullable @Nullable String getPlayerListHeader()
playerListHeader()
@Deprecated @Nullable @Nullable String getPlayerListFooter()
playerListFooter()
@Deprecated void setPlayerListHeader(@Nullable @Nullable String header)
Audience.sendPlayerListHeader(net.kyori.adventure.text.Component)
header
- player list header, null for empty@Deprecated void setPlayerListFooter(@Nullable @Nullable String footer)
Audience.sendPlayerListFooter(net.kyori.adventure.text.Component)
footer
- player list footer, null for empty@Deprecated void setPlayerListHeaderFooter(@Nullable @Nullable String header, @Nullable @Nullable String footer)
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)
header
- player list header, null for emptyfooter
- player list footer, null for emptyvoid setCompassTarget(@NotNull @NotNull Location loc)
loc
- Location to point to@NotNull @NotNull Location getCompassTarget()
@Nullable @Nullable InetSocketAddress getAddress()
getAddress
in interface NetworkClient
void sendRawMessage(@NotNull @NotNull String message)
sendRawMessage
in interface Conversable
message
- Message to be displayed@Deprecated void kickPlayer(@Nullable @Nullable String message)
kick(net.kyori.adventure.text.Component)
message
- kick messagevoid kick(@Nullable net.kyori.adventure.text.Component message)
message
- kick messagevoid chat(@NotNull @NotNull String msg)
msg
- message to printboolean performCommand(@NotNull @NotNull String command)
command
- Command to perform@Deprecated boolean isOnGround()
isOnGround
in interface Entity
isOnGround()
boolean isSneaking()
void setSneaking(boolean sneak)
sneak
- true if player should appear sneakingboolean isSprinting()
void setSprinting(boolean sprinting)
sprinting
- true if the player should be sprintingvoid saveData()
void loadData()
Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file.
void setSleepingIgnored(boolean isSleeping)
isSleeping
- Whether to ignore.boolean isSleepingIgnored()
@Nullable @Nullable Location getBedSpawnLocation()
getBedSpawnLocation
in interface OfflinePlayer
void setBedSpawnLocation(@Nullable @Nullable Location location)
location
- where to set the respawn locationvoid setBedSpawnLocation(@Nullable @Nullable Location location, boolean force)
location
- where to set the respawn locationforce
- whether to forcefully set the respawn location even if a
valid bed is not present@Deprecated void playNote(@NotNull @NotNull Location loc, byte instrument, byte note)
loc
- The location of a note block.instrument
- The instrument ID.note
- The note ID.void playNote(@NotNull @NotNull Location loc, @NotNull @NotNull Instrument instrument, @NotNull @NotNull Note note)
loc
- The location of a note blockinstrument
- The instrumentnote
- The notevoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch)
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- the location to play the soundsound
- the internal sound name to playvolume
- the volume of the soundpitch
- the pitch of the soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- the location to play the soundsound
- the internal sound name to playcategory
- The category of the soundvolume
- the volume of the soundpitch
- the pitch of the soundvoid stopSound(@NotNull @NotNull Sound sound)
sound
- the sound to stopvoid stopSound(@NotNull @NotNull String sound)
sound
- the sound to stopvoid stopSound(@NotNull @NotNull Sound sound, @Nullable @Nullable SoundCategory category)
sound
- the sound to stopcategory
- the category of the soundvoid stopSound(@NotNull @NotNull String sound, @Nullable @Nullable SoundCategory category)
sound
- the sound to stopcategory
- the category of the sound@Deprecated void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, int data)
loc
- the location to play the effect ateffect
- the Effect
data
- a data bit needed for some effects<T> void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, @Nullable T data)
T
- the data based based on the type of the effectloc
- the location to play the effect ateffect
- the Effect
data
- a data bit needed for some effects@Deprecated void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull Material material, byte data)
loc
- The location of the changed blockmaterial
- The new blockdata
- The block datavoid sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull BlockData block)
loc
- The location of the changed blockblock
- The new blockvoid sendBlockDamage(@NotNull @NotNull Location loc, float progress)
loc
- the location of the damaged blockprogress
- the progress from 0.0 - 1.0 where 0 is no damage and
1.0 is the most damaged@Deprecated boolean sendChunkChange(@NotNull @NotNull Location loc, int sx, int sy, int sz, @NotNull @NotNull byte[] data)
At least one of the dimensions of the cuboid must be even. The size of the data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 format.
loc
- The location of the cuboidsx
- The x size of the cuboidsy
- The y size of the cuboidsz
- The z size of the cuboiddata
- The data to be sentvoid sendSignChange(@NotNull @NotNull Location loc, @Nullable List<net.kyori.adventure.text.Component> lines) throws IllegalArgumentException
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
loc
- the location of the signlines
- the new text on the sign or null to clear itIllegalArgumentException
- if location is nullIllegalArgumentException
- if lines is non-null and has a length less than 4void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<net.kyori.adventure.text.Component> lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the signIllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines) throws IllegalArgumentException
sendSignChange(org.bukkit.Location, java.util.List)
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
loc
- the location of the signlines
- the new text on the sign or null to clear itIllegalArgumentException
- if location is nullIllegalArgumentException
- if lines is non-null and has a length less than 4@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException
sendSignChange(org.bukkit.Location, java.util.List, org.bukkit.DyeColor)
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the signIllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4void sendMap(@NotNull @NotNull MapView map)
map
- The map to be sent@Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason)
reason
- Reason for ban@Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable String source)
reason
- Reason for bansource
- Source of ban, or null for default@Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable Date expires)
reason
- Reason for Banexpires
- When to expire the ban@Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source)
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the ban, or null for default@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, boolean kickPlayer)
banPlayerFull(String, Date, String)
reason
- Reason for bankickPlayer
- Whether or not to kick the player afterwards@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source, boolean kickPlayer)
banPlayerFull(String, Date, String)
reason
- Reason for bansource
- Source of ban, or null for defaultkickPlayer
- Whether or not to kick the player afterwards@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, boolean kickPlayer)
banPlayerFull(String, Date, String)
reason
- Reason for Banexpires
- When to expire the bankickPlayer
- Whether or not to kick the player afterwards@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason)
banPlayerFull(String, Date, String)
reason
- Reason for ban@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source)
banPlayerFull(String, Date, String)
reason
- Reason for bansource
- Source of ban, or null for default@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires)
banPlayerFull(String, Date, String)
reason
- Reason for Banexpires
- When to expire the ban@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source)
banPlayerFull(String, Date, String)
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the banm or null for default@Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source, boolean kickPlayer)
banPlayerFull(String, Date, String)
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the banm or null for defaultkickPlayer
- if the targeted player should be kicked@Deprecated void sendActionBar(@NotNull @NotNull String message)
Audience.sendActionBar(Component)
message
- The message to send@Deprecated void sendActionBar(char alternateChar, @NotNull @NotNull String message)
Audience.sendActionBar(Component)
alternateChar
- Alternate symbol such as '&'message
- The message to send@Deprecated void sendActionBar(@NotNull BaseComponent... message)
Audience.sendActionBar(Component)
message
- The components to send@Deprecated default void sendMessage(@NotNull BaseComponent component)
sendMessage
methods that accept Component
sendMessage
in interface CommandSender
component
- the components to send@Deprecated default void sendMessage(@NotNull BaseComponent... components)
sendMessage
methods that accept Component
sendMessage
in interface CommandSender
components
- the components to send@Deprecated default void sendMessage(ChatMessageType position, BaseComponent... components)
sendActionBar(String)
for a more proper Action Bar API. This deprecated API may send unsafe items to the client.position
- the screen positioncomponents
- the components to send@Deprecated void setPlayerListHeaderFooter(@Nullable BaseComponent[] header, @Nullable BaseComponent[] footer)
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)
header
- content for the top of the player listfooter
- content for the bottom of the player list@Deprecated void setPlayerListHeaderFooter(@Nullable BaseComponent header, @Nullable BaseComponent footer)
Audience.sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)
header
- content for the top of the player listfooter
- content for the bottom of the player list@Deprecated void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks)
Audience.showTitle(net.kyori.adventure.title.Title)
fadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out@Deprecated void setSubtitle(BaseComponent[] subtitle)
Audience.showTitle(net.kyori.adventure.title.Title)
subtitle
- Subtitle to set@Deprecated void setSubtitle(BaseComponent subtitle)
Audience.showTitle(net.kyori.adventure.title.Title)
subtitle
- Subtitle to set@Deprecated void showTitle(@Nullable BaseComponent[] title)
Audience.showTitle(net.kyori.adventure.title.Title)
title
- Title to set@Deprecated void showTitle(@Nullable BaseComponent title)
Audience.showTitle(net.kyori.adventure.title.Title)
title
- Title to set@Deprecated void showTitle(@Nullable BaseComponent[] title, @Nullable BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks)
Audience.showTitle(net.kyori.adventure.title.Title)
title
- big textsubtitle
- little text under itfadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out@Deprecated void showTitle(@Nullable BaseComponent title, @Nullable BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks)
Audience.showTitle(net.kyori.adventure.title.Title)
title
- big textsubtitle
- little text under itfadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out@Deprecated void sendTitle(@NotNull @NotNull Title title)
Audience.showTitle(net.kyori.adventure.title.Title)
This method overrides any previous title, use updateTitle(Title)
to change the existing one.
title
- the title to sendNullPointerException
- if the title is null@Deprecated void updateTitle(@NotNull @NotNull Title title)
Audience.showTitle(net.kyori.adventure.title.Title)
This method doesn't override previous titles, but changes their values.
title
- the title to sendNullPointerException
- if title is null@Deprecated void hideTitle()
Audience.clearTitle()
void updateInventory()
void setPlayerTime(long time, boolean relative)
When using non relative time the player's time will stay fixed at the specified time parameter. It's up to the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime().
time
- The current player's perceived time or the player's time
offset from the server time.relative
- When true the player time is kept relative to its world
time.long getPlayerTime()
long getPlayerTimeOffset()
boolean isPlayerTimeRelative()
void resetPlayerTime()
Equivalent to calling setPlayerTime(0, true).
void setPlayerWeather(@NotNull @NotNull WeatherType type)
resetPlayerWeather()
is
used.type
- The WeatherType enum type the player should experience@Nullable @Nullable WeatherType getPlayerWeather()
void resetPlayerWeather()
default void giveExp(int amount)
amount
- Exp amount to givevoid giveExp(int amount, boolean applyMending)
amount
- Exp amount to giveapplyMending
- Mend players items with mending, with same behavior as picking up orbs. calls applyMending(int)
int applyMending(int amount)
giveExp(int, boolean)
by passing true to applyMendingamount
- Exp to applyvoid giveExpLevels(int amount)
amount
- amount of experience levels to give or takefloat getExp()
This is a percentage value. 0 is "no progress" and 1 is "next level".
void setExp(float exp)
This is a percentage value. 0 is "no progress" and 1 is "next level".
exp
- New experience pointsint getLevel()
void setLevel(int level)
level
- New experience levelint getTotalExperience()
void setTotalExperience(int exp)
exp
- New total experience pointsvoid sendExperienceChange(float progress)
progress
- Experience progress percentage (between 0.0 and 1.0)setExp(float)
void sendExperienceChange(float progress, int level)
progress
- New experience progress percentage (between 0.0 and 1.0)level
- New experience levelsetExp(float)
,
setLevel(int)
boolean getAllowFlight()
void setAllowFlight(boolean flight)
flight
- If flight should be allowed.@Deprecated void hidePlayer(@NotNull @NotNull Player player)
hidePlayer(Plugin, Player)
player
- Player to hidevoid hidePlayer(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Player player)
plugin
- Plugin that wants to hide the playerplayer
- Player to hide@Deprecated void showPlayer(@NotNull @NotNull Player player)
showPlayer(Plugin, Player)
player
- Player to showvoid showPlayer(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Player player)
plugin
- Plugin that wants to show the playerplayer
- Player to showboolean canSee(@NotNull @NotNull Player player)
player
- Player to checkboolean isFlying()
void setFlying(boolean value)
value
- True to fly.void setFlySpeed(float value) throws IllegalArgumentException
value
- The new speed, from -1 to 1.IllegalArgumentException
- If new speed is less than -1 or
greater than 1void setWalkSpeed(float value) throws IllegalArgumentException
value
- The new speed, from -1 to 1.IllegalArgumentException
- If new speed is less than -1 or
greater than 1float getFlySpeed()
float getWalkSpeed()
@Deprecated void setTexturePack(@NotNull @NotNull String url)
setResourcePack(String)
.The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the texture
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long.@Deprecated void setResourcePack(@NotNull @NotNull String url)
setResourcePack(String, String)
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the resource
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The
length restriction is an implementation specific arbitrary value.void setResourcePack(@NotNull @NotNull String url, @NotNull @NotNull byte[] hash)
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the resource
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.hash
- The sha1 hash sum of the resource pack file which is used
to apply a cached version of the pack directly without downloading
if it is available. Hast to be 20 bytes long!IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The
length restriction is an implementation specific arbitrary value.IllegalArgumentException
- Thrown if the hash is null.IllegalArgumentException
- Thrown if the hash is not 20 bytes
long.@NotNull @NotNull Scoreboard getScoreboard()
void setScoreboard(@NotNull @NotNull Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException
scoreboard
- New Scoreboard for the playerIllegalArgumentException
- if scoreboard is nullIllegalArgumentException
- if scoreboard was not created by the
scoreboard manager
IllegalStateException
- if this is a player that is not logged
yet or has logged outboolean isHealthScaled()
getHealthScale()
.setHealthScaled(boolean)
void setHealthScaled(boolean scale)
getHealthScale()
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- if the client health display is scaledvoid setHealthScale(double scale) throws IllegalArgumentException
setHealthScaled(true)
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- the number to scale health toIllegalArgumentException
- if scale is <0IllegalArgumentException
- if scale is Double.NaN
IllegalArgumentException
- if scale is too highdouble getHealthScale()
setHealthScale(double)
,
setHealthScaled(boolean)
@Nullable @Nullable Entity getSpectatorTarget()
GameMode.SPECTATOR
.void setSpectatorTarget(@Nullable @Nullable Entity entity)
GameMode.SPECTATOR
.entity
- the entity to follow or null to resetIllegalStateException
- if the player is not in
GameMode.SPECTATOR
@Deprecated void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle)
title
- Title textsubtitle
- Subtitle textvoid sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle, int fadeIn, int stay, int fadeOut)
title
- Title textsubtitle
- Subtitle textfadeIn
- time in ticks for titles to fade in. Defaults to 10.stay
- time in ticks for titles to stay. Defaults to 70.fadeOut
- time in ticks for titles to fade out. Defaults to 20.void resetTitle()
resetTitle
in interface net.kyori.adventure.audience.Audience
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesvoid spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particles<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisvoid spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axis<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
T
- type of particle data (see Particle.getDataType()
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
@NotNull @NotNull AdvancementProgress getAdvancementProgress(@NotNull @NotNull Advancement advancement)
advancement
- advancementint getClientViewDistance()
int getPing()
@NotNull @Deprecated @NotNull String getLocale()
locale()
boolean getAffectsSpawning()
void setAffectsSpawning(boolean affects)
affects
- Whether the player can affect mob spawning@Deprecated int getViewDistance()
World
-based methods still work.World.getViewDistance()
,
World.getNoTickViewDistance()
@Deprecated void setViewDistance(int viewDistance)
World
-based methods still work.viewDistance
- the player's view distanceWorld.setViewDistance(int)
,
World.setNoTickViewDistance(int)
void updateCommands()
void openBook(@NotNull @NotNull ItemStack book)
Material.WRITTEN_BOOK
for a Playerbook
- The book to open for this player@NotNull default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(@NotNull UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op)
asHoverEvent
in interface Entity
asHoverEvent
in interface net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>
void setResourcePack(@NotNull @NotNull String url, @NotNull @NotNull String hash)
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same resource pack in the past, it will perform a quick timestamp check over the network to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
url
- The URL from which the client will download the resource
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.hash
- A 40 character hexadecimal and lowercase SHA-1 digest of
the resource pack file.IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The
length restriction is an implementation specific arbitrary value.@Nullable PlayerResourcePackStatusEvent.Status getResourcePackStatus()
@Nullable @Deprecated @Nullable String getResourcePackHash()
boolean hasResourcePack()
PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED
@NotNull @NotNull PlayerProfile getPlayerProfile()
void setPlayerProfile(@NotNull @NotNull PlayerProfile profile)
profile
- The new profile to usevoid playAnimationToSelf(@NotNull @NotNull EntityAnimation animation)
animation
- the animationfloat getCooldownPeriod()
float getCooledAttackStrength(float adjustTicks)
adjustTicks
- Amount of ticks to add to cooldown counter for this calculationvoid resetCooldown()
@NotNull <T> T getClientOption(@NotNull @NotNull ClientOption<T> option)
@Nullable @Nullable Firework boostElytra(@NotNull @NotNull ItemStack firework)
LivingEntity.isGliding()
using a Firework
.
If the creation of the entity is cancelled, no boosting is done.
This method does not fire PlayerElytraBoostEvent
.firework
- The Material.FIREWORK_ROCKET
to boost the player withFirework
boosting the Player or null if the spawning of the entity was cancelledIllegalArgumentException
- if LivingEntity.isGliding()
is false
or if the firework
isn't a Material.FIREWORK_ROCKET
void sendOpLevel(byte level)
Note: This will not persist across more than the current connection, and setting the player's operator status as a later point will override the effects of this.
level
- The level to send to the player. Must be in [0, 4]
.IllegalArgumentException
- If the level is negative or greater than 4
(i.e. not within [0, 4]
).@NotNull @NotNull Set<Player> getTrackedPlayers()
@Nullable @Nullable String getClientBrandName()
vanilla
. Some modified clients report other names such as forge
.@NotNull @NotNull Player.Spigot spigot()
spigot
in interface CommandSender
spigot
in interface Entity
Copyright © 2021. All rights reserved.