Interface Player
- All Superinterfaces:
AnimalTamer
,Attributable
,Audience
,BossBarViewer
,CommandSender
,ConfigurationSerializable
,Conversable
,Damageable
,Entity
,Frictional
,HoverEventSource<HoverEvent.ShowEntity>
,HumanEntity
,Identified
,InventoryHolder
,LivingEntity
,Metadatable
,Nameable
,NetworkClient
,OfflinePlayer
,Permissible
,PersistentDataHolder
,PersistentDataViewHolder
,PluginMessageRecipient
,Pointered
,ProjectileSource
,ServerOperator
,Sound.Emitter
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescription@UnmodifiableView @NotNull Iterable
<? extends BossBar> Gets an unmodifiable view of all known currently active bossbars.void
addAdditionalChatCompletions
(Collection<String> completions) Deprecated.void
addCustomChatCompletions
(@NotNull Collection<String> completions) Add custom chat completion suggestions shown to the player while typing a message.void
addResourcePack
(@NotNull UUID id, @NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash, @Nullable String prompt, boolean force) Request that the player's client download and include another resource pack.int
applyMending
(int amount) Applies the mending effect to any items just as picking up an orb would.default HoverEvent
<HoverEvent.ShowEntity> Creates a hover event with value derived from this object.<E extends BanEntry<? super PlayerProfile>>
Eban
(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer) Adds this user to theProfileBanList
.<E extends BanEntry<? super PlayerProfile>>
Eban
(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer) Adds this user to theProfileBanList
.<E extends BanEntry<? super PlayerProfile>>
EAdds this user to theProfileBanList
.banIp
(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer) Adds this user's current IP address to theIpBanList
.banIp
(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer) Adds this user's current IP address to theIpBanList
.Adds this user's current IP address to theIpBanList
.default BanEntry
banPlayerFull
(@Nullable String reason) Deprecated.default BanEntry
banPlayerFull
(@Nullable String reason, @Nullable String source) Deprecated.default BanEntry
banPlayerFull
(@Nullable String reason, Date expires) Deprecated.default BanEntry
Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason) Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason, boolean kickPlayer) Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason, @Nullable String source) Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason, @Nullable String source, boolean kickPlayer) Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason, Date expires) Deprecated.default BanEntry
banPlayerIP
(@Nullable String reason, Date expires, boolean kickPlayer) Deprecated.default BanEntry
Deprecated.default BanEntry
Deprecated.boostElytra
(@NotNull ItemStack firework) Deprecated.useHumanEntity.fireworkBoost(ItemStack)
instead.boolean
breakBlock
(@NotNull Block block) Force this player to break a Block using the item in their main hand.@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int
Gets the players total amount of experience points he collected to reach the current level and level progress.boolean
Checks to see if an entity has been visually hidden from this player.boolean
Checks to see if a player has been hidden from this playervoid
Says a message (or runs a command).Gets the "friendly" name to display of this player.void
displayName
(@Nullable Component displayName) Sets the "friendly" name to display of this player.Gets the socket address of this playergetAdvancementProgress
(@NotNull Advancement advancement) Return the player's progression on the specified advancement.boolean
Get whether the player can affect mob spawningboolean
Determines if the Player is allowed to fly via jump key double-tap like in creative mode.Deprecated.Misleading name.Returns player's client brand name.<T> T
getClientOption
(@NotNull ClientOption<T> option) int
Get the player's current client side view distance.Get the previously set compass target.float
Returns the amount of ticks the current cooldown lastsfloat
getCooledAttackStrength
(float adjustTicks) Returns the percentage of attack power available based on the cooldown (zero to one).Deprecated.in favour ofdisplayName()
float
getExp()
Gets the players current experience points towards the next level.int
Gets the player's cooldown between picking up experience orbs.int
Gets the total amount of experience points that are needed to reach the next level from zero progress towards it.float
Gets the current allowed speed that a client can fly.Gets the socket address of this player's proxydouble
Gets the number that health is scaled to for the client.The idle duration is reset when the player sends specific action packets.int
getLevel()
Gets the players current experience levelDeprecated.in favour oflocale()
getName()
Returns the name of this playerdefault int
Deprecated.int
getPing()
Gets the player's estimated ping in milliseconds.Deprecated.in favour ofplayerListFooter()
Deprecated.in favour ofplayerListHeader()
Deprecated.in favour ofplayerListName()
Gets a copy of this players profilelong
Returns the player's current timestamp.long
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.Returns the type of weather the player is currently experiencing.Gets this player's previousGameMode
Deprecated, for removal: This API element is subject to removal in a future version.This is no longer sent from the client and will always be nullGets the most recent resource pack status from the player.Gets the Location where the player will spawn at, null if they don't have a valid respawn point.Gets the Scoreboard displayed to this playerint
Gets the sending view distance for this player.Gets the a set of chunk keys for all chunks that have been sent to the player.Gets the set of chunks that have been sent to the player.int
Gets the simulation distance for this playerGets the entity which is followed by the camera when inGameMode.SPECTATOR
.int
Gets the players total experience points.int
Gets the view distance for this playerfloat
Gets the current allowed speed that a client can walk.int
Returns time since last Warden warning in ticks.int
Returns the player's cooldown in ticks until the next Warden warning can occur.int
Returns the player's current Warden warning level.Gets theWorldBorder
visible to this Player, or null if viewing the world's world border.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.Allows you to get if fall damage is enabled whilegetAllowFlight()
istrue
default boolean
Gets if the last resource pack status from the player wasPlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED
.boolean
Returns whether this player has seen the win screen before.void
hideEntity
(@NotNull Plugin plugin, @NotNull Entity entity) Visually hides an entity from this player.void
hidePlayer
(@NotNull Player player) Deprecated.void
hidePlayer
(@NotNull Plugin plugin, @NotNull Player player) Hides a player from this playervoid
Deprecated.identity()
Gets the identity.void
Increases the player's Warden warning level if possible and not on cooldown.boolean
Gets whether the player has the "Allow Server Listings" setting enabled.boolean
isChunkSent
(long chunkKey) Checks if the player has been sent a specific chunk.default boolean
isChunkSent
(Chunk chunk) Checks if the player has been sent a specific chunk.boolean
isFlying()
Checks to see if this player is currently flying or not.boolean
Gets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale()
.boolean
Returns whether theother
player is listed forthis
.boolean
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 accessedboolean
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
Returns whether the player is sleeping ignored.boolean
Returns if the player is in sneak modeboolean
Gets whether the player is sprinting or not.boolean
Gets if this connection has been transferred from another server.void
kick()
Kicks the player with the default kick message.void
Kicks player with custom kick message.void
kick
(@Nullable Component message, @NotNull PlayerKickEvent.Cause cause) Kicks player with custom kick message and cause.void
kickPlayer
(@Nullable String message) Deprecated.in favour ofkick(net.kyori.adventure.text.Component)
boolean
listPlayer
(@NotNull Player other) Lists theother
player.void
loadData()
Loads the players current location, health, inventory, motion, and other information from the <uuid>.dat file, in the <level-name>/playerdata/ folder.locale()
Gets the player's current locale.void
lookAt
(double x, double y, double z, LookAnchor playerAnchor) Causes the player to look towards the given position.default void
lookAt
(Position position, LookAnchor playerAnchor) Causes the player to look towards the given position.void
lookAt
(Entity entity, LookAnchor playerAnchor, LookAnchor entityAnchor) Causes the player to look towards the given entity.void
Open aMaterial.WRITTEN_BOOK
for a Playervoid
Deprecated.void
Open a Sign for editing by the Player.boolean
performCommand
(@NotNull String command) Makes the player perform the given commandvoid
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.Gets the currently displayed player list footer for this player.Gets the currently displayed player list header for this player.Gets the name that is shown on the in-game player list.void
playerListName
(@Nullable Component name) Sets the name that is shown on the in-game player list.void
Deprecated.Magic valuevoid
Play a note for the player at a location.void
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
playSound
(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location.void
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 Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location.void
Play a sound for a player at the location of the entity.void
playSound
(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location of the entity.void
playSound
(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location of the entity.void
Play a sound for a player at the location of the entity.void
playSound
(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location of the entity.void
playSound
(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location of the entity.void
removeAdditionalChatCompletions
(Collection<String> completions) Deprecated.void
removeCustomChatCompletions
(@NotNull Collection<String> completions) Remove custom chat completion suggestions shown to the player while typing a message.void
Request that the player's client remove a resource pack sent by the server.void
Request that the player's client remove all loaded resource pack sent by the server.void
Reset the cooldown counter to 0, effectively starting the cooldown period.void
Resets this player's idle duration.void
Restores the normal condition where the player's time is synchronized with the server time.void
Restores the normal condition where the player's weather is controlled by server conditions.void
Resets the title displayed to the player.@NotNull CompletableFuture
<byte[]> Retrieves a cookie from this player.void
saveData()
Saves the players current location, health, inventory, motion, and other information into the <uuid>.dat file, in the <level-name>/playerdata/ folder.void
sendActionBar
(char alternateChar, @NotNull String message) Deprecated.void
sendActionBar
(@NotNull String message) Deprecated.void
sendActionBar
(net.md_5.bungee.api.chat.BaseComponent... message) Deprecated.void
sendBlockChange
(@NotNull Location loc, @NotNull Material material, byte data) Deprecated.Magic valuevoid
sendBlockChange
(@NotNull Location loc, @NotNull BlockData block) Send a block change.void
sendBlockChanges
(@NotNull Collection<BlockState> blocks) Send a multi-block change.void
sendBlockChanges
(@NotNull Collection<BlockState> blocks, boolean suppressLightUpdates) Deprecated.suppressLightUpdates is not functional in versions greater than 1.19.4void
sendBlockDamage
(@NotNull Location loc, float progress) Send block damage.void
sendBlockDamage
(@NotNull Location loc, float progress, int sourceId) Send block damage.void
sendBlockDamage
(@NotNull Location loc, float progress, @NotNull Entity source) Send block damage.void
sendBlockUpdate
(@NotNull Location loc, @NotNull TileState tileState) Send a TileState change.void
sendEntityEffect
(@NotNull EntityEffect effect, @NotNull Entity target) Plays an entity effect to this player for the target entityvoid
sendEquipmentChange
(@NotNull LivingEntity entity, @NotNull Map<EquipmentSlot, ItemStack> items) Send multiple equipment changes for the target entity.void
sendEquipmentChange
(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @Nullable ItemStack item) Send an equipment change for the target entity.void
sendExperienceChange
(float progress) Send an experience change.void
sendExperienceChange
(float progress, int level) Send an experience change.void
Send a health update to the player using its known server values.void
sendHealthUpdate
(double health, int foodLevel, float saturation) Send a health update to the player.void
sendHurtAnimation
(float yaw) Send a hurt animation.void
sendLinks
(@NotNull ServerLinks links) Sends the given server links to the player.void
Render a map and send it to the player in its entirety.default void
sendMessage
(net.md_5.bungee.api.chat.BaseComponent component) Deprecated.usesendMessage
methods that acceptComponent
default void
sendMessage
(net.md_5.bungee.api.chat.BaseComponent... components) Deprecated.usesendMessage
methods that acceptComponent
default void
sendMessage
(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) Deprecated.This is unlikely the API you want to use.void
sendMultiBlockChange
(@NotNull Map<? extends Position, BlockData> blockChanges) Send multiple block changes.default void
sendMultiBlockChange
(@NotNull Map<? extends Position, BlockData> blockChanges, boolean suppressLightUpdates) Deprecated.suppressLightUpdates is no longer available in 1.20+, usesendMultiBlockChange(Map)
void
sendOpLevel
(byte level) Send a packet to the player indicating its operator status level.void
sendPotionEffectChange
(@NotNull LivingEntity entity, @NotNull PotionEffect effect) Change a potion effect for the target entity.void
sendPotionEffectChangeRemove
(@NotNull LivingEntity entity, @NotNull PotionEffectType type) Remove a potion effect for the target entity.void
sendRawMessage
(@NotNull String message) Sends this sender a message rawvoid
sendSignChange
(@NotNull Location loc, @Nullable String[] lines) Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.void
Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.void
sendSignChange
(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.default void
sendSignChange
(@NotNull Location loc, List<? extends Component> lines) Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.default void
sendSignChange
(@NotNull Location loc, List<? extends Component> lines, boolean hasGlowingText) Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.default void
Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.void
sendSignChange
(@NotNull Location loc, List<? extends Component> lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g.void
void
void
void
setAffectsSpawning
(boolean affects) Set whether the player can affect mob spawningvoid
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) Deprecated.Misleading name.void
setBedSpawnLocation
(@Nullable Location location, boolean force) Deprecated.Misleading name.void
Set the target of the player's compass.void
setCustomChatCompletions
(@NotNull Collection<String> completions) Set the list of chat completion suggestions shown to the player while typing a message.void
setDisplayName
(@Nullable String name) Deprecated.in favour ofdisplayName(net.kyori.adventure.text.Component)
void
setExp
(float exp) Sets the players current experience points towards the next levelvoid
setExpCooldown
(int ticks) Sets the player's cooldown between picking up experience orbs..void
setExperienceLevelAndProgress
(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int totalExperience) Updates the players level and level progress to that what would be reached when the total amount of experience had been collected.void
setFlying
(boolean value) Makes this player start or stop flying.void
setFlyingFallDamage
(TriState flyingFallDamage) Allows you to enable fall damage whilegetAllowFlight()
istrue
void
setFlySpeed
(float value) Sets the speed at which a client will fly.void
setHasSeenWinScreen
(boolean hasSeenWinScreen) Changes whether this player has seen the win screen before.void
setHealthScale
(double scale) Sets the number to scale health to for the client; this will alsosetHealthScaled(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 leveldefault void
setNoTickViewDistance
(int viewDistance) Deprecated.void
setPlayerListFooter
(@Nullable String footer) Deprecated.void
setPlayerListHeader
(@Nullable String header) Deprecated.void
setPlayerListHeaderFooter
(@Nullable String header, @Nullable String footer) void
setPlayerListHeaderFooter
(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer) void
setPlayerListHeaderFooter
(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer) void
setPlayerListName
(@Nullable String name) Deprecated.in favour ofplayerListName(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
Sets the type of weather the player will see.void
Deprecated.void
setResourcePack
(@NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash) Deprecated.void
setResourcePack
(@NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash, boolean force) Deprecated.void
setResourcePack
(@NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash, @Nullable String prompt) Deprecated.void
setResourcePack
(@NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash, @Nullable String prompt, boolean force) Deprecated.default void
Request that the player's client download and switch resource packs.default void
setResourcePack
(@NotNull String url, byte @Nullable [] hash, @Nullable Component prompt, boolean force) Request that the player's client download and switch resource packs.default void
setResourcePack
(@NotNull String url, @NotNull String hash) Request that the player's client download and switch resource packs.default void
setResourcePack
(@NotNull String url, @NotNull String hash, boolean required) Request that the player's client download and switch resource packs.default void
setResourcePack
(@NotNull String url, @NotNull String hash, boolean required, @Nullable Component resourcePackPrompt) Request that the player's client download and switch resource packs.void
setResourcePack
(@NotNull UUID id, @NotNull String url, @org.jetbrains.annotations.Nullable byte[] hash, @Nullable String prompt, boolean force) Deprecated.void
setResourcePack
(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, @Nullable Component prompt, boolean force) Request that the player's client download and switch resource packs.default void
setResourcePack
(@NotNull UUID uuid, @NotNull String url, @NotNull String hash, @Nullable Component resourcePackPrompt, boolean required) Request that the player's client download and switch resource packs.void
setRespawnLocation
(@Nullable Location location) Sets the Location where the player will respawn.void
setRespawnLocation
(@Nullable Location location, boolean force) Sets the Location where the player will respawn.void
setRotation
(float yaw, float pitch) Sets the player's rotation.void
setScoreboard
(@NotNull Scoreboard scoreboard) Sets the player's visible Scoreboard.void
setSendViewDistance
(int viewDistance) Sets the sending view distance for this player.void
setSimulationDistance
(int simulationDistance) Sets the simulation distance for this playervoid
setSleepingIgnored
(boolean isSleeping) Sets whether the player is ignored as not sleeping.void
setSneaking
(boolean sneak) Sets the sneak mode the playervoid
setSpectatorTarget
(@Nullable Entity entity) Sets the entity which is followed by the camera when inGameMode.SPECTATOR
.void
setSprinting
(boolean sprinting) Sets whether the player is sprinting or not.void
setSubtitle
(net.md_5.bungee.api.chat.BaseComponent subtitle) void
setSubtitle
(net.md_5.bungee.api.chat.BaseComponent[] subtitle) void
setTexturePack
(@NotNull String url) Deprecated.Minecraft no longer uses textures packs.void
setTitleTimes
(int fadeInTicks, int stayTicks, int fadeOutTicks) void
setTotalExperience
(int exp) Sets the players current experience points.void
setViewDistance
(int viewDistance) Sets the view distance for this playervoid
setWalkSpeed
(float value) Sets the speed at which a client will walk.void
setWardenTimeSinceLastWarning
(int time) Sets time since last Warden warning in ticks.void
setWardenWarningCooldown
(int cooldown) Sets the player's cooldown in ticks until next Warden warning can occur.void
setWardenWarningLevel
(int warningLevel) Sets the player's Warden warning level.void
setWorldBorder
(@Nullable WorldBorder border) Sets theWorldBorder
visible to this Player.void
Shows the demo screen to the player, this screen is normally only seen in the demo version of the game.default void
Displays elder guardian effect with a soundvoid
showElderGuardian
(boolean silent) Displays elder guardian effect and optionally plays a soundvoid
showEntity
(@NotNull Plugin plugin, @NotNull Entity entity) Allows this player to see an entity that was previously hidden.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
(net.md_5.bungee.api.chat.BaseComponent title) void
showTitle
(net.md_5.bungee.api.chat.BaseComponent[] title) void
showTitle
(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) void
showTitle
(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) void
Shows the player the win screen that normally is only displayed after one kills the ender dragon and exits the end for the first time.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, double extra, T data, boolean force) 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, double extra, T data, boolean force) 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.spigot()
void
Stop all sounds from playing.void
Stop the specified sound from playing.void
stopSound
(@NotNull String sound, @Nullable SoundCategory category) Stop the specified sound from playing.void
Stop the specified sound from playing.void
stopSound
(@NotNull SoundCategory category) Stop the specified sound category from playing.void
stopSound
(@NotNull Sound sound, @Nullable SoundCategory category) Stop the specified sound from playing.void
storeCookie
(@NotNull NamespacedKey key, @org.jetbrains.annotations.NotNull byte[] value) Stores a cookie in this player's client.void
Requests this player to connect to a different server specified by host and port.boolean
unlistPlayer
(@NotNull Player other) Unlists theother
player from the tablist.void
Update the list of commands sent to the client.void
Forces an update of the player's entire inventory.void
updateTitle
(Title title) Methods inherited from interface org.bukkit.attribute.Attributable
getAttribute, registerAttribute
Methods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface org.bukkit.command.CommandSender
name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage, sendRichMessage
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
Methods inherited from interface org.bukkit.conversations.Conversable
abandonConversation, abandonConversation, acceptConversationInput, beginConversation, isConversing, sendRawMessage
Methods inherited from interface org.bukkit.entity.Damageable
damage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, heal, heal, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, broadcastHurtAnimation, collidesAt, copy, copy, createSnapshot, eject, fromMobSpawner, getAsString, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, hasNoPhysics, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isInBubbleColumn, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isInWorld, isPersistent, isSilent, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setNoPhysics, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, teleportAsync, wouldCollideUsing
Methods inherited from interface io.papermc.paper.entity.Frictional
getFrictionState, setFrictionState
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.bukkit.entity.HumanEntity
closeInventory, closeInventory, discoverRecipe, discoverRecipes, dropItem, fireworkBoost, getAttackCooldown, getBedLocation, getCooldown, getDiscoveredRecipes, getEnchantmentSeed, getEnderChest, getEquipment, getExhaustion, getExpToLevel, getFishHook, getFoodLevel, getGameMode, getInventory, getItemInHand, getItemOnCursor, getLastDeathLocation, getMainHand, getOpenInventory, getPotentialBedLocation, getSaturatedRegenRate, getSaturation, getShoulderEntityLeft, getShoulderEntityRight, getSleepTicks, getStarvationRate, getUnsaturatedRegenRate, hasCooldown, hasDiscoveredRecipe, isBlocking, isDeeplySleeping, isHandRaised, openAnvil, openCartographyTable, openEnchanting, openGrindstone, openInventory, openInventory, openLoom, openMerchant, openMerchant, openSmithingTable, openStonecutter, openWorkbench, releaseLeftShoulderEntity, releaseRightShoulderEntity, setCooldown, setEnchantmentSeed, setExhaustion, setFoodLevel, setGameMode, setHurtDirection, setItemInHand, setItemOnCursor, setLastDeathLocation, setSaturatedRegenRate, setSaturation, setShoulderEntityLeft, setShoulderEntityRight, setStarvationRate, setUnsaturatedRegenRate, setWindowProperty, sleep, startRiptideAttack, undiscoverRecipe, undiscoverRecipes, wakeup
Methods inherited from interface org.bukkit.entity.LivingEntity
addPotionEffect, addPotionEffect, addPotionEffects, attack, broadcastSlotBreak, broadcastSlotBreak, canBreatheUnderwater, canUseEquipmentSlot, clearActiveItem, clearActivePotionEffects, completeUsingActiveItem, damageItemStack, damageItemStack, getActiveItem, getActiveItemHand, getActiveItemRemainingTime, getActiveItemUsedTime, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getArrowsStuck, getBeeStingerCooldown, getBeeStingersInBody, getBodyYaw, getCanPickupItems, getCategory, getCollidableExemptions, getDeathSound, getDrinkingSound, getEatingSound, getEyeHeight, getEyeHeight, getEyeLocation, getFallDamageSound, getFallDamageSoundBig, getFallDamageSoundSmall, getForwardsMovement, getHandRaised, getHandRaisedTime, getHurtDirection, getHurtSound, getItemInUse, getItemInUseTicks, getItemUseRemainingTime, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNextArrowRemoval, getNextBeeStingerRemoval, getNoActionTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getShieldBlockingDelay, getSidewaysMovement, getTargetBlock, getTargetBlock, getTargetBlock, getTargetBlockExact, getTargetBlockExact, getTargetBlockFace, getTargetBlockFace, getTargetBlockFace, getTargetBlockInfo, getTargetBlockInfo, getTargetEntity, getTargetEntity, getTargetEntityInfo, getTargetEntityInfo, getUpwardsMovement, hasActiveItem, hasAI, hasLineOfSight, hasLineOfSight, hasPotionEffect, isClimbing, isCollidable, isGliding, isInvisible, isJumping, isLeashed, isRiptiding, isSleeping, isSwimming, knockback, playHurtAnimation, playPickupItemAnimation, playPickupItemAnimation, rayTraceBlocks, rayTraceBlocks, rayTraceEntities, rayTraceEntities, removePotionEffect, setActiveItemRemainingTime, setAI, setArrowCooldown, setArrowsInBody, setArrowsInBody, setArrowsStuck, setBeeStingerCooldown, setBeeStingersInBody, setBodyYaw, setCanPickupItems, setCollidable, setGliding, setInvisible, setItemInUseTicks, setJumping, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNextArrowRemoval, setNextBeeStingerRemoval, setNoActionTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setRiptiding, setShieldBlockingDelay, setSwimming, startUsingItem, swingHand, swingMainHand, swingOffHand
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
customName, customName, getCustomName, setCustomName
Methods inherited from interface com.destroystokyo.paper.network.NetworkClient
getProtocolVersion, getVirtualHost
Methods inherited from interface org.bukkit.OfflinePlayer
ban, ban, ban, banPlayer, banPlayer, banPlayer, banPlayer, banPlayer, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, decrementStatistic, getFirstPlayed, getLastDeathLocation, getLastLogin, getLastPlayed, getLastSeen, getLocation, getPersistentDataContainer, getPlayer, getStatistic, getStatistic, getStatistic, getUniqueId, hasPlayedBefore, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, incrementStatistic, isBanned, isConnected, isOnline, isWhitelisted, setStatistic, setStatistic, setStatistic, setWhitelisted
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface org.bukkit.plugin.messaging.PluginMessageRecipient
getListeningPluginChannels, sendPluginMessage
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
Methods inherited from interface org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile, launchProjectile
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
identity
Description copied from interface:net.kyori.adventure.identity.Identified
Gets the identity.- Specified by:
identity
in interfaceIdentified
- Returns:
- the identity
-
activeBossBars
Gets an unmodifiable view of all known currently active bossbars.This currently only returns bossbars shown to the player via
Audience.showBossBar(net.kyori.adventure.bossbar.BossBar)
and does not contain bukkitBossBar
instances shown to the player.- Specified by:
activeBossBars
in interfaceBossBarViewer
- Returns:
- an unmodifiable view of all known currently active bossbars
- Since:
- 4.14.0
-
displayName
Gets the "friendly" name to display of this player.- Returns:
- the display name
-
displayName
Sets the "friendly" name to display of this player.- Parameters:
displayName
- the display name to set
-
getName
Returns the name of this player- Specified by:
getName
in interfaceAnimalTamer
- Specified by:
getName
in interfaceCommandSender
- Specified by:
getName
in interfaceHumanEntity
- Specified by:
getName
in interfaceOfflinePlayer
- Returns:
- Player name
-
getDisplayName
Deprecated.in favour ofdisplayName()
Gets the "friendly" name to display of this player. This may include color.Note that this name will not be displayed in game, only in chat and places defined by plugins.
- Returns:
- the friendly name
-
setDisplayName
Deprecated.in favour ofdisplayName(net.kyori.adventure.text.Component)
Sets the "friendly" name to display of this player. This may include color.Note that this name will not be displayed in game, only in chat and places defined by plugins.
- Parameters:
name
- The new display name.
-
playerListName
Sets the name that is shown on the in-game player list.If the value is null, the name will be identical to
getName()
.- Parameters:
name
- new player list name
-
playerListName
Gets the name that is shown on the in-game player list.- Returns:
- the player list name
-
playerListHeader
Gets the currently displayed player list header for this player.- Returns:
- player list header or null
-
getPlayerListName
Deprecated.in favour ofplayerListName()
Gets the name that is shown on the player list.- Returns:
- the player list name
-
setPlayerListName
Deprecated.in favour ofplayerListName(net.kyori.adventure.text.Component)
Sets the name that is shown on the in-game player list.If the value is null, the name will be identical to
getName()
.- Parameters:
name
- new player list name
-
getPlayerListHeader
Deprecated.in favour ofplayerListHeader()
Gets the currently displayed player list header for this player.- Returns:
- player list header or null
-
setPlayerListHeader
Deprecated.Sets the currently displayed player list header for this player.- Parameters:
header
- player list header, null for empty
-
setCompassTarget
Set the target of the player's compass.- Parameters:
loc
- Location to point to
-
getCompassTarget
Get the previously set compass target.- Returns:
- location of the target
-
getAddress
Gets the socket address of this player- Specified by:
getAddress
in interfaceNetworkClient
- Returns:
- the player's address
-
getHAProxyAddress
Gets the socket address of this player's proxy- Returns:
- the player's proxy address, null if the server doesn't have Proxy Protocol enabled, or the player didn't connect to an HAProxy instance
-
isTransferred
boolean isTransferred()Gets if this connection has been transferred from another server.- Returns:
- true if the connection has been transferred
-
retrieveCookie
Retrieves a cookie from this player.- Parameters:
key
- the key identifying the cookie cookie- Returns:
- a
CompletableFuture
that will be completed when the Cookie response is received or otherwise available. If the cookie is not set in the client, theCompletableFuture
will complete with a null value.
-
storeCookie
void storeCookie(@NotNull @NotNull NamespacedKey key, @NotNull @org.jetbrains.annotations.NotNull byte[] value) Stores a cookie in this player's client.- Parameters:
key
- the key identifying the cookie cookievalue
- the data to store in the cookie- Throws:
IllegalStateException
- if a cookie cannot be stored at this time
-
transfer
Requests this player to connect to a different server specified by host and port.- Parameters:
host
- the host of the server to transfer toport
- the port of the server to transfer to- Throws:
IllegalStateException
- if a transfer cannot take place at this time
-
sendRawMessage
Sends this sender a message raw- Specified by:
sendRawMessage
in interfaceConversable
- Parameters:
message
- Message to be displayed
-
kickPlayer
Deprecated.in favour ofkick(net.kyori.adventure.text.Component)
Kicks player with custom kick message.- Parameters:
message
- kick message
-
kick
void kick()Kicks the player with the default kick message.- See Also:
-
kick
Kicks player with custom kick message.- Parameters:
message
- kick message
-
kick
Kicks player with custom kick message and cause.- Parameters:
message
- kick messagecause
- kick cause
-
ban
@Nullable <E extends BanEntry<? super PlayerProfile>> E ban(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source, boolean kickPlayer) Adds this user to theProfileBanList
. If a previous ban exists, this will update the entry.- Parameters:
reason
- reason for the ban, null indicates implementation defaultexpires
- date for the ban's expiration (unban), or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
ban
@Nullable <E extends BanEntry<? super PlayerProfile>> E ban(@Nullable @Nullable String reason, @Nullable @Nullable Instant expires, @Nullable @Nullable String source, boolean kickPlayer) Adds this user to theProfileBanList
. If a previous ban exists, this will update the entry.- Parameters:
reason
- reason for the ban, null indicates implementation defaultexpires
- date for the ban's expiration (unban), or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
ban
@Nullable <E extends BanEntry<? super PlayerProfile>> E ban(@Nullable @Nullable String reason, @Nullable @Nullable Duration duration, @Nullable @Nullable String source, boolean kickPlayer) Adds this user to theProfileBanList
. If a previous ban exists, this will update the entry.- Parameters:
reason
- reason for the ban, null indicates implementation defaultduration
- the duration how long the ban lasts, or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
banIp
@Nullable @Nullable BanEntry<InetAddress> banIp(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source, boolean kickPlayer) Adds this user's current IP address to theIpBanList
. If a previous ban exists, this will update the entry. IfgetAddress()
is null this method will throw an exception.- Parameters:
reason
- reason for the ban, null indicates implementation defaultexpires
- date for the ban's expiration (unban), or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
banIp
@Nullable @Nullable BanEntry<InetAddress> banIp(@Nullable @Nullable String reason, @Nullable @Nullable Instant expires, @Nullable @Nullable String source, boolean kickPlayer) Adds this user's current IP address to theIpBanList
. If a previous ban exists, this will update the entry. IfgetAddress()
is null this method will throw an exception.- Parameters:
reason
- reason for the ban, null indicates implementation defaultexpires
- date for the ban's expiration (unban), or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
banIp
@Nullable @Nullable BanEntry<InetAddress> banIp(@Nullable @Nullable String reason, @Nullable @Nullable Duration duration, @Nullable @Nullable String source, boolean kickPlayer) Adds this user's current IP address to theIpBanList
. If a previous ban exists, this will update the entry. IfgetAddress()
is null this method will throw an exception.- Parameters:
reason
- reason for the ban, null indicates implementation defaultduration
- the duration how long the ban lasts, or null to imply foreversource
- source of the ban, null indicates implementation defaultkickPlayer
- if the player need to be kick- Returns:
- the entry for the newly created ban, or the entry for the (updated) previous ban
-
chat
Says a message (or runs a command).- Parameters:
msg
- message to print
-
performCommand
Makes the player perform the given command- Parameters:
command
- Command to perform- Returns:
- true if the command was successful, otherwise false
-
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 accessedReturns true if the entity is supported by a block. This value is a state updated by the client after each movement.- Specified by:
isOnGround
in interfaceEntity
- Returns:
- True if entity is on ground.
- See Also:
-
isSneaking
boolean isSneaking()Returns if the player is in sneak mode- Specified by:
isSneaking
in interfaceEntity
- Returns:
- true if player is in sneak mode
-
setSneaking
void setSneaking(boolean sneak) Sets the sneak mode the player- Specified by:
setSneaking
in interfaceEntity
- Parameters:
sneak
- true if player should appear sneaking
-
isSprinting
boolean isSprinting()Gets whether the player is sprinting or not.- Returns:
- true if player is sprinting.
-
setSprinting
void setSprinting(boolean sprinting) Sets whether the player is sprinting or not.- Parameters:
sprinting
- true if the player should be sprinting
-
saveData
void saveData()Saves the players current location, health, inventory, motion, and other information into the <uuid>.dat file, in the <level-name>/playerdata/ folder. -
loadData
void loadData()Loads the players current location, health, inventory, motion, and other information from the <uuid>.dat file, in the <level-name>/playerdata/ folder.Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file.
-
setSleepingIgnored
void setSleepingIgnored(boolean isSleeping) Sets whether the player is ignored as not sleeping. If everyone is either sleeping or has this flag set, then time will advance to the next day. If everyone has this flag set but no one is actually in bed, then nothing will happen.- Parameters:
isSleeping
- Whether to ignore.
-
isSleepingIgnored
boolean isSleepingIgnored()Returns whether the player is sleeping ignored.- Returns:
- Whether player is ignoring sleep.
-
getBedSpawnLocation
Deprecated.Misleading name. This method also returns the location of respawn anchors.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.- Specified by:
getBedSpawnLocation
in interfaceOfflinePlayer
- Returns:
- Bed Spawn Location if bed exists, otherwise null.
- See Also:
-
getRespawnLocation
Gets the Location where the player will spawn at, null if they don't have a valid respawn point.- Specified by:
getRespawnLocation
in interfaceOfflinePlayer
- Returns:
- respawn location if exists, otherwise null.
-
setBedSpawnLocation
Deprecated.Misleading name. This method sets the player's respawn location more generally and is not limited to beds.Sets the Location where the player will spawn at their bed.- Parameters:
location
- where to set the respawn location- See Also:
-
setRespawnLocation
Sets the Location where the player will respawn.- Parameters:
location
- where to set the respawn location
-
setBedSpawnLocation
Deprecated.Misleading name. This method sets the player's respawn location more generally and is not limited to beds.Sets the Location where the player will spawn at their bed.- Parameters:
location
- where to set the respawn locationforce
- whether to forcefully set the respawn location even if a valid bed is not present- See Also:
-
setRespawnLocation
Sets the Location where the player will respawn.- Parameters:
location
- where to set the respawn locationforce
- whether to forcefully set the respawn location even if a valid respawn point is not present
-
playNote
Deprecated.Magic valuePlay a note for the player at a location.
This will work with cake.- Parameters:
loc
- The location to play the noteinstrument
- The instrument ID.note
- The note ID.
-
playNote
void playNote(@NotNull @NotNull Location loc, @NotNull @NotNull Instrument instrument, @NotNull @NotNull Note note) Play a note for the player at a location.
This will work with cake.This method will fail silently when called with
Instrument.CUSTOM_HEAD
.- Parameters:
loc
- The location to play the noteinstrument
- The instrumentnote
- The note
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch) Play a sound for a player at the location.This function will fail silently if Location or Sound are null.
- Parameters:
location
- The location to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch) Play a sound for a player at the location.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.
- Parameters:
location
- The location to play the soundsound
- The internal sound name to playvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location.This function will fail silently if Location or Sound are null.
- Parameters:
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 sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location.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.
- Parameters:
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 sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location. For sounds with multiple variations passing the same seed will always play the same variation.This function will fail silently if Location or Sound are null.
- Parameters:
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 soundseed
- The seed for the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location. For sounds with multiple variations passing the same seed will always play the same variation.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.
- Parameters:
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 soundseed
- The seed for the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, float volume, float pitch) Play a sound for a player at the location of the entity.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, float volume, float pitch) Play a sound for a player at the location of the entity.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location of the entity.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch) Play a sound for a player at the location of the entity.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location of the entity. For sounds with multiple variations passing the same seed will always play the same variation.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- The seed for the sound
-
playSound
void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed) Play a sound for a player at the location of the entity. For sounds with multiple variations passing the same seed will always play the same variation.This function will fail silently if Entity or Sound are null.
- Parameters:
entity
- The entity to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- The seed for the sound
-
stopSound
Stop the specified sound from playing.- Parameters:
sound
- the sound to stop
-
stopSound
Stop the specified sound from playing.- Parameters:
sound
- the sound to stop
-
stopSound
Stop the specified sound from playing.- Parameters:
sound
- the sound to stopcategory
- the category of the sound
-
stopSound
Stop the specified sound from playing.- Parameters:
sound
- the sound to stopcategory
- the category of the sound
-
stopSound
Stop the specified sound category from playing.- Parameters:
category
- the sound category to stop
-
stopAllSounds
void stopAllSounds()Stop all sounds from playing. -
playEffect
@Deprecated void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, int data) Deprecated.Magic valuePlays an effect to just this player.- Parameters:
loc
- the location to play the effect ateffect
- theEffect
data
- a data bit needed for some effects
-
playEffect
<T> void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, @Nullable T data) Plays an effect to just this player.- Type Parameters:
T
- the data based on the type of the effect- Parameters:
loc
- the location to play the effect ateffect
- theEffect
data
- a data bit needed for some effects
-
breakBlock
Force this player to break a Block using the item in their main hand. This method will respect enchantments, handle item durability (if applicable) and drop experience and the correct items according to the tool/item in the player's hand.Note that this method will call a
BlockBreakEvent
, meaning that this method may not be successful in breaking the block if the event was cancelled by a third party plugin. Care should be taken if running this method in a BlockBreakEvent listener as recursion may be possible if it is invoked on the sameBlock
being broken in the event.Additionally, a
BlockDropItemEvent
is called for the items dropped by this method (if successful).The block must be in the same world as the player.
- Parameters:
block
- the block to break- Returns:
- true if the block was broken, false if the break failed
-
sendBlockChange
@Deprecated void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull Material material, byte data) Deprecated.Magic valueSend a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.- Parameters:
loc
- The location of the changed blockmaterial
- The new blockdata
- The block data
-
sendBlockChange
Send a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.- Parameters:
loc
- The location of the changed blockblock
- The new block
-
sendBlockChanges
Send a multi-block change. This fakes a block change packet for a user at multiple locations. This will not actually change the world in any way.This method may send multiple packets to the client depending on the blocks in the collection. A packet must be sent for each chunk section modified, meaning one packet for each 16x16x16 block area. Even if only one block is changed in two different chunk sections, two packets will be sent.
Additionally, this method cannot guarantee the functionality of changes being sent to the player in chunks not loaded by the client. It is the responsibility of the caller to ensure that the client is within range of the changed blocks or to handle any side effects caused as a result.
- Parameters:
blocks
- the block states to send to the player
-
sendBlockChanges
@Deprecated void sendBlockChanges(@NotNull @NotNull Collection<BlockState> blocks, boolean suppressLightUpdates) Deprecated.suppressLightUpdates is not functional in versions greater than 1.19.4Send a multi-block change. This fakes a block change packet for a user at multiple locations. This will not actually change the world in any way.This method may send multiple packets to the client depending on the blocks in the collection. A packet must be sent for each chunk section modified, meaning one packet for each 16x16x16 block area. Even if only one block is changed in two different chunk sections, two packets will be sent.
Additionally, this method cannot guarantee the functionality of changes being sent to the player in chunks not loaded by the client. It is the responsibility of the caller to ensure that the client is within range of the changed blocks or to handle any side effects caused as a result.
- Parameters:
blocks
- the block states to send to the playersuppressLightUpdates
- whether or not light updates should be suppressed when updating the blocks on the client
-
sendBlockDamage
Send block damage. This fakes block break progress at a certain location sourced by this player. This will not actually change the block's break progress in any way.- Parameters:
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
-
sendMultiBlockChange
Send multiple block changes. This fakes a multi block change packet for each chunk section that a block change occurs. This will not actually change the world in any way.- Parameters:
blockChanges
- A map of the positions you want to change to their new block data
-
sendMultiBlockChange
@Deprecated default void sendMultiBlockChange(@NotNull @NotNull Map<? extends Position, BlockData> blockChanges, boolean suppressLightUpdates) Deprecated.suppressLightUpdates is no longer available in 1.20+, usesendMultiBlockChange(Map)
Send multiple block changes. This fakes a multi block change packet for each chunk section that a block change occurs. This will not actually change the world in any way.- Parameters:
blockChanges
- A map of the positions you want to change to their new block datasuppressLightUpdates
- Whether to suppress light updates or not
-
sendBlockDamage
void sendBlockDamage(@NotNull @NotNull Location loc, float progress, @NotNull @NotNull Entity source) Send block damage. This fakes block break progress at a certain location sourced by the provided entity. This will not actually change the block's break progress in any way.At the same location for each unique damage source sent to the player, a separate damage overlay will be displayed with the given progress. This allows for block damage at different progress from multiple entities at once.
- Parameters:
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 damagedsource
- the entity to which the damage belongs
-
sendBlockDamage
Send block damage. This fakes block break progress at a certain location sourced by the provided entity id. This will not actually change the block's break progress in any way.At the same location for each unique damage source sent to the player, a separate damage overlay will be displayed with the given progress. This allows for block damage at different progress from multiple entities at once.
- Parameters:
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 damagedsourceId
- the entity id of the entity to which the damage belongs. Can be an id that does not associate directly with an existing or loaded entity.
-
sendEquipmentChange
void sendEquipmentChange(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull EquipmentSlot slot, @Nullable @Nullable ItemStack item) Send an equipment change for the target entity. This will not actually change the entity's equipment in any way.- Parameters:
entity
- the entity whose equipment to changeslot
- the slot to changeitem
- the item to which the slot should be changed, or null to set it to air
-
sendEquipmentChange
void sendEquipmentChange(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull Map<EquipmentSlot, ItemStack> items) Send multiple equipment changes for the target entity. This will not actually change the entity's equipment in any way.- Parameters:
entity
- the entity whose equipment to changeitems
- the slots to change, where the values are the items to which the slot should be changed. null values will set the slot to air
-
sendSignChange
@Deprecated default void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<? extends Component> lines) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(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.
- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear it- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated default void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<? extends Component> lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(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.
- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the sign- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated default void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<? extends Component> lines, boolean hasGlowingText) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(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.
- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear ithasGlowingText
- whether the text of the sign should glow as if dyed with a glowing ink sac- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<? extends Component> lines, @NotNull @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(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.
- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the signhasGlowingText
- whether the text of the sign should glow as if dyed with a glowing ink sac- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)
.If the client does not have a sign at the given location it will display an error message to the user.
To change all attributes of a sign, including the back Side, use
sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)
.- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear it- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)
.If the client does not have a sign at the given location it will display an error message to the user.
To change all attributes of a sign, including the back Side, use
sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)
.- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the sign- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendSignChange
@Deprecated void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines, @NotNull @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException Deprecated.UsesendBlockUpdate(Location, TileState)
by creating a new virtualSign
block state viaBlockData.createBlockState()
(constructed e.g. viaMaterial.createBlockData()
)Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent viasendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)
.If the client does not have a sign at the given location it will display an error message to the user.
To change all attributes of a sign, including the back Side, use
sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)
.- Parameters:
loc
- the location of the signlines
- the new text on the sign or null to clear itdyeColor
- the color of the signhasGlowingText
- if the sign's text should be glowing- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if dyeColor is nullIllegalArgumentException
- if lines is non-null and has a length less than 4
-
sendBlockUpdate
@Experimental void sendBlockUpdate(@NotNull @NotNull Location loc, @NotNull @NotNull TileState tileState) throws IllegalArgumentException Send a TileState change. This fakes a TileState change for a user at the given location. This will not actually change the world in any way. This method will use a TileState at the location's block or a faked TileState sent viasendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)
.If the client does not have an appropriate tile at the given location it may display an error message to the user.
BlockData.createBlockState()
can be used to create aBlockState
.- Parameters:
loc
- the location of the signtileState
- the tile state- Throws:
IllegalArgumentException
- if location is nullIllegalArgumentException
- if tileState is null
-
sendPotionEffectChange
void sendPotionEffectChange(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull PotionEffect effect) Change a potion effect for the target entity. This will not actually change the entity's potion effects in any way.Note: Sending an effect change to a player for themselves may cause unexpected behavior on the client. Effects sent this way will also not be removed when their timer reaches 0, they can be removed with
sendPotionEffectChangeRemove(LivingEntity, PotionEffectType)
- Parameters:
entity
- the entity whose potion effects to changeeffect
- the effect to change
-
sendPotionEffectChangeRemove
void sendPotionEffectChangeRemove(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull PotionEffectType type) Remove a potion effect for the target entity. This will not actually change the entity's potion effects in any way.Note: Sending an effect change to a player for themselves may cause unexpected behavior on the client.
- Parameters:
entity
- the entity whose potion effects to changetype
- the effect type to remove
-
sendMap
Render a map and send it to the player in its entirety. This may be used when streaming the map in the normal manner is not desirable.- Parameters:
map
- The map to be sent
-
showWinScreen
void showWinScreen()Shows the player the win screen that normally is only displayed after one kills the ender dragon and exits the end for the first time. In vanilla, the win screen starts with a poem and then continues with the credits but its content can be changed by using a resource pack.
Calling this method does not change the value ofhasSeenWinScreen()
. That means that the win screen is still displayed to a player if they leave the end for the first time, even though they have seen it before because this method was called. Note this method does not make the player invulnerable, which is normally expected when viewing credits.- See Also:
-
hasSeenWinScreen
boolean hasSeenWinScreen()Returns whether this player has seen the win screen before. When a player leaves the end the win screen is shown to them if they have not seen it before.- Returns:
- Whether this player has seen the win screen before
- See Also:
-
setHasSeenWinScreen
void setHasSeenWinScreen(boolean hasSeenWinScreen) Changes whether this player has seen the win screen before. When a player leaves the end the win screen is shown to them if they have not seen it before.- Parameters:
hasSeenWinScreen
- Whether this player has seen the win screen before- See Also:
-
banPlayerFull
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerFull(@Nullable @Nullable String reason) Deprecated.Permanently Bans the Profile and IP address currently used by the player.- Parameters:
reason
- Reason for ban- Returns:
- Ban Entry
-
banPlayerFull
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable String source) Deprecated.Permanently Bans the Profile and IP address currently used by the player.- Parameters:
reason
- Reason for bansource
- Source of ban, or null for default- Returns:
- Ban Entry
-
banPlayerFull
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable Date expires) Deprecated.Bans the Profile and IP address currently used by the player.- Parameters:
reason
- Reason for Banexpires
- When to expire the ban- Returns:
- Ban Entry
-
banPlayerFull
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable Date expires, @Nullable @Nullable String source) Deprecated.Bans the Profile and IP address currently used by the player.- Parameters:
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the ban, or null for default- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, boolean kickPlayer) Deprecated.Permanently Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for bankickPlayer
- Whether or not to kick the player afterwards- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source, boolean kickPlayer) Deprecated.Permanently Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for bansource
- Source of ban, or null for defaultkickPlayer
- Whether or not to kick the player afterwards- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable Date expires, boolean kickPlayer) Deprecated.Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for Banexpires
- When to expire the bankickPlayer
- Whether or not to kick the player afterwards- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason) Deprecated.Permanently Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for ban- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source) Deprecated.Permanently Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for bansource
- Source of ban, or null for default- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable Date expires) Deprecated.Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for Banexpires
- When to expire the ban- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable Date expires, @Nullable @Nullable String source) Deprecated.Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the ban or null for default- Returns:
- Ban Entry
-
banPlayerIP
@Nullable @Deprecated(since="1.20.4") default BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable Date expires, @Nullable @Nullable String source, boolean kickPlayer) Deprecated.Bans the IP address currently used by the player. Does not ban the Profile, usebanPlayerFull(String, java.util.Date, String)
- Parameters:
reason
- Reason for Banexpires
- When to expire the bansource
- Source of the ban or null for defaultkickPlayer
- if the targeted player should be kicked- Returns:
- Ban Entry
-
sendActionBar
Deprecated.Sends an Action Bar message to the client. Use Section symbols for legacy color codes to send formatting.- Parameters:
message
- The message to send
-
sendActionBar
Deprecated.Sends an Action Bar message to the client. Use supplied alternative character to the section symbol to represent legacy color codes.- Parameters:
alternateChar
- Alternate symbol such as '&'message
- The message to send
-
sendActionBar
Deprecated.Sends an Action Bar message to the client.- Parameters:
message
- The components to send
-
sendMessage
Deprecated.usesendMessage
methods that acceptComponent
Sends the component to the player- Specified by:
sendMessage
in interfaceCommandSender
- Parameters:
component
- the components to send
-
sendMessage
Deprecated.usesendMessage
methods that acceptComponent
Sends an array of components as a single message to the player- Specified by:
sendMessage
in interfaceCommandSender
- Parameters:
components
- the components to send
-
sendMessage
@Deprecated default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) Deprecated.This is unlikely the API you want to use. SeesendActionBar(String)
for a more proper Action Bar API. This deprecated API may send unsafe items to the client.Sends an array of components as a single message to the specified screen position of this player- Parameters:
position
- the screen positioncomponents
- the components to send
-
setTitleTimes
Deprecated.Update the times for titles displayed to the player- Parameters:
fadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out
-
setSubtitle
Deprecated.Update the subtitle of titles displayed to the player- Parameters:
subtitle
- Subtitle to set
-
setSubtitle
Deprecated.Update the subtitle of titles displayed to the player- Parameters:
subtitle
- Subtitle to set
-
showTitle
Deprecated.Show the given title to the player, along with the last subtitle set, using the last set times- Parameters:
title
- Title to set
-
showTitle
Deprecated.Show the given title to the player, along with the last subtitle set, using the last set times- Parameters:
title
- Title to set
-
showTitle
@Deprecated void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title, @Nullable net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) Deprecated.Show the given title and subtitle to the player using the given times- Parameters:
title
- big textsubtitle
- little text under itfadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out
-
showTitle
@Deprecated void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title, @Nullable net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) Deprecated.Show the given title and subtitle to the player using the given times- Parameters:
title
- big textsubtitle
- little text under itfadeInTicks
- ticks to fade-instayTicks
- ticks to stay visiblefadeOutTicks
- ticks to fade-out
-
sendTitle
Deprecated.Show the title to the player, overriding any previously displayed title.This method overrides any previous title, use
updateTitle(com.destroystokyo.paper.Title)
to change the existing one.- Parameters:
title
- the title to send- Throws:
NullPointerException
- if the title is null
-
updateTitle
Deprecated.Show the title to the player, overriding any previously displayed title.This method doesn't override previous titles, but changes their values.
- Parameters:
title
- the title to send- Throws:
NullPointerException
- if title is null
-
hideTitle
Deprecated.Hide any title that is currently visible to the player -
sendHurtAnimation
void sendHurtAnimation(float yaw) Send a hurt animation. This fakes incoming damage towards the player from the given yaw relative to the player's direction.- Parameters:
yaw
- the yaw in degrees relative to the player's direction where 0 is in front of the player, 90 is to the right, 180 is behind, and 270 is to the left
-
sendLinks
Sends the given server links to the player.- Parameters:
links
- links to send
-
addCustomChatCompletions
Add custom chat completion suggestions shown to the player while typing a message.- Parameters:
completions
- the completions to send
-
removeCustomChatCompletions
Remove custom chat completion suggestions shown to the player while typing a message. Online player names cannot be removed with this method. This will affect only custom completions added byaddCustomChatCompletions(Collection)
orsetCustomChatCompletions(Collection)
.- Parameters:
completions
- the completions to remove
-
setCustomChatCompletions
Set the list of chat completion suggestions shown to the player while typing a message.If completions were set previously, this method will remove them all and replace them with the provided completions.
- Parameters:
completions
- the completions to set
-
updateInventory
void updateInventory()Forces an update of the player's entire inventory. -
getPreviousGameMode
Gets this player's previousGameMode
- Returns:
- Previous game mode or null
-
setPlayerTime
void setPlayerTime(long time, boolean relative) Sets the current time on the player's client. When relative is true the player's time will be kept synchronized to its world time with the specified offset.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().
- Parameters:
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.
-
getPlayerTime
long getPlayerTime()Returns the player's current timestamp.- Returns:
- The player's time
-
getPlayerTimeOffset
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.- Returns:
- The player's time
-
isPlayerTimeRelative
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().- Returns:
- true if the player's time is relative to the server time.
-
resetPlayerTime
void resetPlayerTime()Restores the normal condition where the player's time is synchronized with the server time.Equivalent to calling setPlayerTime(0, true).
-
setPlayerWeather
Sets the type of weather the player will see. When used, the weather status of the player is locked untilresetPlayerWeather()
is used.- Parameters:
type
- The WeatherType enum type the player should experience
-
getPlayerWeather
Returns the type of weather the player is currently experiencing.- Returns:
- The WeatherType that the player is currently experiencing or null if player is seeing server weather.
-
resetPlayerWeather
void resetPlayerWeather()Restores the normal condition where the player's weather is controlled by server conditions. -
giveExp
default void giveExp(int amount) Gives the player the amount of experience specified.- Parameters:
amount
- Exp amount to give
-
getExpCooldown
int getExpCooldown()Gets the player's cooldown between picking up experience orbs.- Returns:
- The cooldown in ticks
-
setExpCooldown
void setExpCooldown(int ticks) Sets the player's cooldown between picking up experience orbs.. Note: Setting this to 0 allows the player to pick up instantly, but setting this to a negative value will cause the player to be unable to pick up xp-orbs. Calling this Method will result inPlayerExpCooldownChangeEvent
being called.- Parameters:
ticks
- The cooldown in ticks
-
giveExp
void giveExp(int amount, boolean applyMending) Gives the player the amount of experience specified.- Parameters:
amount
- Exp amount to giveapplyMending
- Mend players items with mending, with same behavior as picking up orbs. callsapplyMending(int)
-
applyMending
int applyMending(int amount) Applies the mending effect to any items just as picking up an orb would. Can also be called withgiveExp(int, boolean)
by passing true to applyMending- Parameters:
amount
- Exp to apply- Returns:
- the remaining experience
-
giveExpLevels
void giveExpLevels(int amount) Gives the player the amount of experience levels specified. Levels can be taken by specifying a negative amount.- Parameters:
amount
- amount of experience levels to give or take
-
getExp
float getExp()Gets the players current experience points towards the next level.This is a percentage value. 0 is "no progress" and 1 is "next level".
- Returns:
- Current experience points
-
setExp
void setExp(float exp) Sets the players current experience points towards the next levelThis is a percentage value. 0 is "no progress" and 1 is "next level".
- Parameters:
exp
- New experience points
-
getLevel
int getLevel()Gets the players current experience level- Returns:
- Current experience level
-
setLevel
void setLevel(int level) Sets the players current experience level- Parameters:
level
- New experience level
-
getTotalExperience
int getTotalExperience()Gets the players total experience points.
This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.- Returns:
- Current total experience points
-
setTotalExperience
void setTotalExperience(int exp) Sets the players current experience points.
This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.- Parameters:
exp
- New total experience points
-
calculateTotalExperiencePoints
@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int calculateTotalExperiencePoints()Gets the players total amount of experience points he collected to reach the current level and level progress.This method differs from
getTotalExperience()
in that this method always returns an up-to-date value that reflects the playerslevel
andlevel progress
- Returns:
- Current total experience points
- See Also:
-
setExperienceLevelAndProgress
void setExperienceLevelAndProgress(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int totalExperience) Updates the players level and level progress to that what would be reached when the total amount of experience had been collected.This method differs from
setTotalExperience(int)
in that this method actually updates thelevel
andlevel progress
so that a subsequent call ofcalculateTotalExperiencePoints()
yields the same amount of points that have been set- Parameters:
totalExperience
- New total experience points- See Also:
-
getExperiencePointsNeededForNextLevel
int getExperiencePointsNeededForNextLevel()Gets the total amount of experience points that are needed to reach the next level from zero progress towards it.Can be used with
getExp()
to calculate the current points for the current level and alike- Returns:
- The required experience points
- See Also:
-
sendExperienceChange
void sendExperienceChange(float progress) Send an experience change. This fakes an experience change packet for a user. This will not actually change the experience points in any way.- Parameters:
progress
- Experience progress percentage (between 0.0 and 1.0)- See Also:
-
sendExperienceChange
void sendExperienceChange(float progress, int level) Send an experience change. This fakes an experience change packet for a user. This will not actually change the experience points in any way.- Parameters:
progress
- New experience progress percentage (between 0.0 and 1.0)level
- New experience level- See Also:
-
getAllowFlight
boolean getAllowFlight()Determines if the Player is allowed to fly via jump key double-tap like in creative mode.- Returns:
- True if the player is allowed to fly.
-
setAllowFlight
void setAllowFlight(boolean flight) Sets if the Player is allowed to fly via jump key double-tap like in creative mode.- Parameters:
flight
- If flight should be allowed.
-
setFlyingFallDamage
Allows you to enable fall damage whilegetAllowFlight()
istrue
- Parameters:
flyingFallDamage
- Enables fall damage whengetAllowFlight()
istrue
-
hasFlyingFallDamage
Allows you to get if fall damage is enabled whilegetAllowFlight()
istrue
- Returns:
- A tristate of whether fall damage is enabled, not set, or disabled when
getAllowFlight()
istrue
-
hidePlayer
Deprecated.Hides a player from this player- Parameters:
player
- Player to hide
-
hidePlayer
Hides a player from this player- Parameters:
plugin
- Plugin that wants to hide the playerplayer
- Player to hide
-
showPlayer
Deprecated.Allows this player to see a player that was previously hidden- Parameters:
player
- Player to show
-
showPlayer
Allows this player to see a player that was previously hidden. If another plugin had hidden the player too, then the player will remain hidden until the other plugin calls this method too.- Parameters:
plugin
- Plugin that wants to show the playerplayer
- Player to show
-
canSee
Checks to see if a player has been hidden from this player- Parameters:
player
- Player to check- Returns:
- True if the provided player is not being hidden from this player
-
hideEntity
Visually hides an entity from this player.- Parameters:
plugin
- Plugin that wants to hide the entityentity
- Entity to hide
-
showEntity
Allows this player to see an entity that was previously hidden. If another plugin had hidden the entity too, then the entity will remain hidden until the other plugin calls this method too.- Parameters:
plugin
- Plugin that wants to show the entityentity
- Entity to show
-
canSee
Checks to see if an entity has been visually hidden from this player.- Parameters:
entity
- Entity to check- Returns:
- True if the provided entity is not being hidden from this player
-
isListed
Returns whether theother
player is listed forthis
.- Parameters:
other
- The otherPlayer
to check for listing.- Returns:
- True if the
other
player is listed forthis
.
-
unlistPlayer
Unlists theother
player from the tablist.- Parameters:
other
- The otherPlayer
to de-list.- Returns:
- True if the
other
player was listed.
-
listPlayer
Lists theother
player.- Parameters:
other
- The otherPlayer
to list.- Returns:
- True if the
other
player was not listed.
-
isFlying
boolean isFlying()Checks to see if this player is currently flying or not.- Returns:
- True if the player is flying, else false.
-
setFlying
void setFlying(boolean value) Makes this player start or stop flying.- Parameters:
value
- True to fly.
-
setFlySpeed
Sets the speed at which a client will fly. Negative values indicate reverse directions.- Parameters:
value
- The new speed, from -1 to 1.- Throws:
IllegalArgumentException
- If new speed is less than -1 or greater than 1
-
setWalkSpeed
Sets the speed at which a client will walk. Negative values indicate reverse directions.- Parameters:
value
- The new speed, from -1 to 1.- Throws:
IllegalArgumentException
- If new speed is less than -1 or greater than 1
-
getFlySpeed
float getFlySpeed()Gets the current allowed speed that a client can fly.- Returns:
- The current allowed speed, from -1 to 1
-
getWalkSpeed
float getWalkSpeed()Gets the current allowed speed that a client can walk.- Returns:
- The current allowed speed, from -1 to 1
-
setTexturePack
Deprecated.Minecraft no longer uses textures packs. Instead you should usesetResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)
.Request that the player's client download and switch texture packs.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:
- Players can disable server textures on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - The request is send with "null" as the hash. This might result in newer versions not loading the pack correctly.
- Parameters:
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.- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long.
- Players can disable server textures on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
Deprecated.Request that the player's client download and switch resource packs.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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - The request is send with empty string as the hash. This might result in newer versions not loading the pack correctly.
- Parameters:
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.- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
@Deprecated void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash) Deprecated.Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
@Deprecated void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt) Deprecated.Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!prompt
- The optional custom prompt message to be shown to client.- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
default void setResourcePack(@NotNull @NotNull String url, byte @Nullable [] hash, @Nullable Component prompt) Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!prompt
- The optional custom prompt message to be shown to client.- Throws:
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 not 20 bytes long.- See Also:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
@Deprecated void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, boolean force) Deprecated.Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
@Deprecated void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt, boolean force) Deprecated.Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!prompt
- The optional custom prompt message to be shown to client.force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
default void setResourcePack(@NotNull @NotNull String url, byte @Nullable [] hash, @Nullable Component prompt, boolean force) Request that the player's client download and switch resource packs.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. If the hash is null and 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 with a custom prompt to the player before proceeding with the download.
Notes:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
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!prompt
- The optional custom prompt message to be shown to client.force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.- See Also:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
@Deprecated void setResourcePack(@NotNull @NotNull UUID id, @NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt, boolean force) Deprecated.Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
id
- Unique resource pack ID.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!prompt
- The optional custom prompt message to be shown to client.force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
void setResourcePack(@NotNull @NotNull UUID uuid, @NotNull @NotNull String url, byte @Nullable [] hash, @Nullable Component prompt, boolean force) Request that the player's client download and switch resource packs.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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
uuid
- Unique resource pack ID.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!prompt
- The optional custom prompt message to be shown to client.force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.- See Also:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
setResourcePack
Request that the player's client download and switch resource packs.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:
- Players can disable server resources on their client, in which case this method will have no affect on them.
- To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
.
- Parameters:
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.- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
-
setResourcePack
default void setResourcePack(@NotNull @NotNull String url, @NotNull @NotNull String hash, boolean required) Request that the player's client download and switch resource packs.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:
- Players can disable server resources on their client, in which case this method will have no affect on them.
- To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
.
- Parameters:
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.required
- Marks if the resource pack should be required by the client- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
-
setResourcePack
default void setResourcePack(@NotNull @NotNull String url, @NotNull @NotNull String hash, boolean required, @Nullable Component resourcePackPrompt) Request that the player's client download and switch resource packs.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:
- Players can disable server resources on their client, in which case this method will have no affect on them.
- To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
.
- Parameters:
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.required
- Marks if the resource pack should be required by the clientresourcePackPrompt
- A Prompt to be displayed in the client request- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
-
setResourcePack
default void setResourcePack(@NotNull @NotNull UUID uuid, @NotNull @NotNull String url, @NotNull @NotNull String hash, @Nullable Component resourcePackPrompt, boolean required) Request that the player's client download and switch resource packs.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:
- Players can disable server resources on their client, in which case this method will have no affect on them.
- To remove a resource pack you can use
Audience.removeResourcePacks(UUID, UUID...)
orAudience.clearResourcePacks()
.
- Parameters:
uuid
- Unique resource pack ID.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.resourcePackPrompt
- A Prompt to be displayed in the client requestrequired
- Marks if the resource pack should be required by the client- Throws:
IllegalArgumentException
- Thrown if the URL is null.IllegalArgumentException
- Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
-
getResourcePackStatus
@Nullable PlayerResourcePackStatusEvent.Status getResourcePackStatus()Gets the most recent resource pack status from the player.- Returns:
- the most recent status or null
-
getResourcePackHash
@Deprecated(forRemoval=true, since="1.13.2") @Contract("-> null") @Nullable default @Nullable String getResourcePackHash()Deprecated, for removal: This API element is subject to removal in a future version.This is no longer sent from the client and will always be nullGets the most recent pack hash from the player.- Returns:
- the most recent hash or null
-
hasResourcePack
default boolean hasResourcePack()Gets if the last resource pack status from the player wasPlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED
.- Returns:
- true if last status was successfully loaded
-
addResourcePack
void addResourcePack(@NotNull @NotNull UUID id, @NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt, boolean force) Request that the player's client download and include another resource pack.The player's client will download the new resource pack asynchronously in the background, and will automatically add 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. If the hash is null and 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:
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
PlayerResourcePackStatusEvent
to figure out whether or not the player loaded the pack! - To remove a resource pack you can use
removeResourcePack(UUID)
orremoveResourcePacks()
. - The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
- Parameters:
id
- Unique resource pack ID.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!prompt
- The optional custom prompt message to be shown to client.force
- If true, the client will be disconnected from the server when it declines to use the resource pack.- Throws:
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 not 20 bytes long.
- Players can disable server resources on their client, in which
case this method will have no affect on them. Use the
-
removeResourcePack
Request that the player's client remove a resource pack sent by the server.- Parameters:
id
- the id of the resource pack.- Throws:
IllegalArgumentException
- If the ID is null.- See Also:
-
removeResourcePacks
void removeResourcePacks()Request that the player's client remove all loaded resource pack sent by the server.- See Also:
-
getScoreboard
Gets the Scoreboard displayed to this player- Returns:
- The current scoreboard seen by this player
-
setScoreboard
void setScoreboard(@NotNull @NotNull Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException Sets the player's visible Scoreboard.- Parameters:
scoreboard
- New Scoreboard for the player- Throws:
IllegalArgumentException
- if scoreboard is nullIllegalArgumentException
- if scoreboard was not created by thescoreboard manager
IllegalStateException
- if this is a player that is not logged yet or has logged out
-
getWorldBorder
Gets theWorldBorder
visible to this Player, or null if viewing the world's world border.- Returns:
- the player's world border
-
setWorldBorder
Sets theWorldBorder
visible to this Player.- Parameters:
border
- the border to set, or null to set to the world border of the player's current world- Throws:
UnsupportedOperationException
- if setting the border to that of a world in which the player is not currently present.- See Also:
-
sendHealthUpdate
void sendHealthUpdate(double health, int foodLevel, float saturation) Send a health update to the player. This will adjust the health, food, and saturation on the client and will not affect the player's actual values on the server. As soon as any of these values change on the server, changes sent by this method will no longer be visible.- Parameters:
health
- the health. If 0.0, the client will believe it is deadfoodLevel
- the food levelsaturation
- the saturation
-
sendHealthUpdate
void sendHealthUpdate()Send a health update to the player using its known server values. This will synchronize the health, food, and saturation on the client and therefore may be useful when changing a player's maximum health attribute. -
isHealthScaled
boolean isHealthScaled()Gets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale()
.- Returns:
- if client health display is scaled
- See Also:
-
setHealthScaled
void setHealthScaled(boolean scale) Sets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale()
.Displayed health follows a simple formula
displayedHealth = getHealth() / getMaxHealth() * getHealthScale()
.- Parameters:
scale
- if the client health display is scaled
-
setHealthScale
Sets the number to scale health to for the client; this will alsosetHealthScaled(true)
.Displayed health follows a simple formula
displayedHealth = getHealth() / getMaxHealth() * getHealthScale()
.- Parameters:
scale
- the number to scale health to- Throws:
IllegalArgumentException
- if scale is <0IllegalArgumentException
- if scale isDouble.NaN
IllegalArgumentException
- if scale is too high
-
getHealthScale
double getHealthScale()Gets the number that health is scaled to for the client.- Returns:
- the number that health would be scaled to for the client if HealthScaling is set to true
- See Also:
-
getSpectatorTarget
Gets the entity which is followed by the camera when inGameMode.SPECTATOR
.- Returns:
- the followed entity, or null if not in spectator mode or not following a specific entity.
-
setSpectatorTarget
Sets the entity which is followed by the camera when inGameMode.SPECTATOR
.- Parameters:
entity
- the entity to follow or null to reset- Throws:
IllegalStateException
- if the player is not inGameMode.SPECTATOR
-
sendTitle
Deprecated.Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. The titles will be displayed with the client's default timings.- Parameters:
title
- Title textsubtitle
- Subtitle text
-
sendTitle
@Deprecated void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle, int fadeIn, int stay, int fadeOut) Deprecated.Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. All timings values may take a value of -1 to indicate that they will use the last value sent (or the defaults if no title has been displayed).- Parameters:
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.
-
resetTitle
void resetTitle()Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values.- Specified by:
resetTitle
in interfaceAudience
- See Also:
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count) Spawns the particle (the number of times specified by count) at the target location.- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particles
-
spawnParticle
Spawns the particle (the number of times specified by count) at the target location.- Parameters:
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
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data) Spawns the particle (the number of times specified by count) at the target location.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data) Spawns the particle (the number of times specified by count) at the target location.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @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. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
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 axis
-
spawnParticle
void spawnParticle(@NotNull @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. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
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
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @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. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
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)
-
spawnParticle
void spawnParticle(@NotNull @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. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
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)
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
<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) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
force
- whether to send the particle to the player in an extended range and encourage their client to render it regardless of settings
-
spawnParticle
<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, boolean force) Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
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 onParticle.getDataType()
force
- whether to send the particle to the player in an extended range and encourage their client to render it regardless of settings
-
getAdvancementProgress
@NotNull @NotNull AdvancementProgress getAdvancementProgress(@NotNull @NotNull Advancement advancement) Return the player's progression on the specified advancement.- Parameters:
advancement
- advancement- Returns:
- object detailing the player's progress
-
getClientViewDistance
int getClientViewDistance()Get the player's current client side view distance.
Will default to the server view distance if the client has not yet communicated this information,- Returns:
- client view distance as above
-
locale
Gets the player's current locale.- Returns:
- the player's locale
-
getPing
int getPing()Gets the player's estimated ping in milliseconds. In Vanilla this value represents a weighted average of the response time to application layer ping packets sent. This value does not represent the network round trip time and as such may have less granularity and be impacted by other sources. For these reasons it should not be used for anti-cheat purposes. Its recommended use is only as a qualitative indicator of connection quality (Vanilla uses it for this purpose in the tab list).- Returns:
- player ping
-
getLocale
Deprecated.in favour oflocale()
Gets the player's current locale. The value of the locale String is not defined properly.
The vanilla Minecraft client will use lowercase language / country pairs separated by an underscore, but custom resource packs may use any format they wish.- Returns:
- the player's locale
-
getAffectsSpawning
boolean getAffectsSpawning()Get whether the player can affect mob spawning- Returns:
- if the player can affect mob spawning
-
setAffectsSpawning
void setAffectsSpawning(boolean affects) Set whether the player can affect mob spawning- Parameters:
affects
- Whether the player can affect mob spawning
-
getViewDistance
int getViewDistance()Gets the view distance for this player- Returns:
- the player's view distance
- See Also:
-
setViewDistance
void setViewDistance(int viewDistance) Sets the view distance for this player- Parameters:
viewDistance
- the player's view distance- See Also:
-
getSimulationDistance
int getSimulationDistance()Gets the simulation distance for this player- Returns:
- the player's simulation distance
-
setSimulationDistance
void setSimulationDistance(int simulationDistance) Sets the simulation distance for this player- Parameters:
simulationDistance
- the player's new simulation distance
-
getNoTickViewDistance
Deprecated.Gets the no-ticking view distance for this player.No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
- Returns:
- The no-tick view distance for this player.
-
setNoTickViewDistance
Deprecated.Sets the no-ticking view distance for this player.No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
- Parameters:
viewDistance
- view distance in [2, 32] or -1
-
getSendViewDistance
int getSendViewDistance()Gets the sending view distance for this player.Sending view distance is the view distance where chunks will load in for players.
- Returns:
- The sending view distance for this player.
-
setSendViewDistance
void setSendViewDistance(int viewDistance) Sets the sending view distance for this player.Sending view distance is the view distance where chunks will load in for players.
- Parameters:
viewDistance
- view distance in [2, 32] or -1
-
updateCommands
void updateCommands()Update the list of commands sent to the client.
Generally useful to ensure the client has a complete list of commands after permission changes are done. -
openBook
Open aMaterial.WRITTEN_BOOK
for a Player- Parameters:
book
- The book to open for this player
-
openSign
Deprecated.Open a Sign for editing by the Player. The Sign must be in the same world as the player.- Specified by:
openSign
in interfaceHumanEntity
- Parameters:
sign
- The sign to edit
-
openSign
Open a Sign for editing by the Player. The Sign must be placed in the same world as the player.- Specified by:
openSign
in interfaceHumanEntity
- Parameters:
sign
- The sign to editside
- The side to edit
-
showDemoScreen
void showDemoScreen()Shows the demo screen to the player, this screen is normally only seen in the demo version of the game.
Servers can modify the text on this screen using a resource pack. -
isAllowingServerListings
boolean isAllowingServerListings()Gets whether the player has the "Allow Server Listings" setting enabled.- Returns:
- whether the player allows server listings
-
asHoverEvent
@NotNull default HoverEvent<HoverEvent.ShowEntity> asHoverEvent(@NotNull UnaryOperator<HoverEvent.ShowEntity> op) Description copied from interface:net.kyori.adventure.text.event.HoverEventSource
Creates a hover event with value derived from this object.The event value will be passed through the provided callback to allow transforming the original value of the event.
- Specified by:
asHoverEvent
in interfaceEntity
- Specified by:
asHoverEvent
in interfaceHoverEventSource<HoverEvent.ShowEntity>
- Parameters:
op
- transformation on value- Returns:
- a hover event
-
getPlayerProfile
@NotNull PlayerProfile getPlayerProfile()Gets a copy of this players profile- Specified by:
getPlayerProfile
in interfaceOfflinePlayer
- Returns:
- The players profile object
-
setPlayerProfile
Changes the PlayerProfile for this player. This will cause this player to be re-registered to all clients that can currently see this player.After executing this method, the player
UUID
won't be swapped, only their name and profile properties.- Parameters:
profile
- The new profile to use
-
getCooldownPeriod
float getCooldownPeriod()Returns the amount of ticks the current cooldown lasts- Returns:
- Amount of ticks cooldown will last
-
getCooledAttackStrength
float getCooledAttackStrength(float adjustTicks) Returns the percentage of attack power available based on the cooldown (zero to one).- Parameters:
adjustTicks
- Amount of ticks to add to cooldown counter for this calculation- Returns:
- Percentage of attack power available
-
resetCooldown
void resetCooldown()Reset the cooldown counter to 0, effectively starting the cooldown period. -
getClientOption
- Returns:
- the client option value of the player
-
boostElytra
Deprecated.useHumanEntity.fireworkBoost(ItemStack)
instead. Note that this method does not check if the player is gliding or not.Boost a Player that'sLivingEntity.isGliding()
using aFirework
. If the creation of the entity is cancelled, no boosting is done. This method does not firePlayerElytraBoostEvent
.- Parameters:
firework
- TheMaterial.FIREWORK_ROCKET
to boost the player with- Returns:
- The
Firework
boosting the Player or null if the spawning of the entity was cancelled - Throws:
IllegalArgumentException
- ifLivingEntity.isGliding()
is false or if thefirework
isn't aMaterial.FIREWORK_ROCKET
-
sendOpLevel
void sendOpLevel(byte level) Send a packet to the player indicating its operator status 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.
- Parameters:
level
- The level to send to the player. Must be in[0, 4]
.- Throws:
IllegalArgumentException
- If the level is negative or greater than4
(i.e. not within[0, 4]
).
-
addAdditionalChatCompletions
@Deprecated(since="1.20.1") void addAdditionalChatCompletions(@NotNull Collection<String> completions) Deprecated.Adds custom chat completion suggestions that the client will suggest when typing in chat.- Parameters:
completions
- custom completions
-
removeAdditionalChatCompletions
@Deprecated(since="1.20.1") void removeAdditionalChatCompletions(@NotNull Collection<String> completions) Deprecated.Removes custom chat completion suggestions that the client suggests when typing in chat. Note: this only applies to previously added custom completions, online player names are always suggested and cannot be removed.- Parameters:
completions
- custom completions
-
getClientBrandName
Returns player's client brand name. If the client didn't send this information, the brand name will be null.
For the Notchian client this name defaults tovanilla
. Some modified clients report other names such asforge
.- Returns:
- client brand name
-
setRotation
void setRotation(float yaw, float pitch) Sets the player's rotation.- Specified by:
setRotation
in interfaceEntity
- Parameters:
yaw
- the yawpitch
- the pitch
-
lookAt
Causes the player to look towards the given position.- Parameters:
x
- x coordinatey
- y coordinatez
- z coordinateplayerAnchor
- What part of the player should face the given position
-
lookAt
Causes the player to look towards the given position.- Parameters:
position
- Position to look at in the player's current worldplayerAnchor
- What part of the player should face the given position
-
lookAt
void lookAt(@NotNull Entity entity, @NotNull LookAnchor playerAnchor, @NotNull LookAnchor entityAnchor) Causes the player to look towards the given entity.- Parameters:
entity
- Entity to look atplayerAnchor
- What part of the player should face the entityentityAnchor
- What part of the entity the player should face
-
showElderGuardian
default void showElderGuardian()Displays elder guardian effect with a sound- See Also:
-
showElderGuardian
void showElderGuardian(boolean silent) Displays elder guardian effect and optionally plays a sound- Parameters:
silent
- whether sound should be silenced
-
getWardenWarningCooldown
int getWardenWarningCooldown()Returns the player's cooldown in ticks until the next Warden warning can occur.- Returns:
- ticks until next Warden warning can occur. 0 means there is no cooldown left.
-
setWardenWarningCooldown
void setWardenWarningCooldown(int cooldown) Sets the player's cooldown in ticks until next Warden warning can occur.- Parameters:
cooldown
- ticks until next Warden warning can occur. 0 means there is no cooldown left. Values less than 0 are set to 0.
-
getWardenTimeSinceLastWarning
int getWardenTimeSinceLastWarning()Returns time since last Warden warning in ticks.- Returns:
- ticks since last Warden warning
-
setWardenTimeSinceLastWarning
void setWardenTimeSinceLastWarning(int time) Sets time since last Warden warning in ticks.- Parameters:
time
- ticks since last Warden warning
-
getWardenWarningLevel
int getWardenWarningLevel()Returns the player's current Warden warning level.- Returns:
- current Warden warning level
-
setWardenWarningLevel
void setWardenWarningLevel(int warningLevel) Sets the player's Warden warning level.Note: This will not actually spawn the Warden. Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden.
- Parameters:
warningLevel
- player's Warden warning level. The warning level is internally limited to valid values.
-
increaseWardenWarningLevel
void increaseWardenWarningLevel()Increases the player's Warden warning level if possible and not on cooldown.Note: This will not actually spawn the Warden. Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden.
-
getIdleDuration
The idle duration is reset when the player sends specific action packets.After the idle duration exceeds
Bukkit.getIdleTimeout()
, the player will be kicked forPlayerKickEvent.Cause.IDLING
.- Returns:
- the current idle duration of this player
-
resetIdleDuration
void resetIdleDuration()Resets this player's idle duration.After the idle duration exceeds
Bukkit.getIdleTimeout()
, the player will be kicked forPlayerKickEvent.Cause.IDLING
.- See Also:
-
getSentChunkKeys
Gets the a set of chunk keys for all chunks that have been sent to the player.- Returns:
- an immutable set of chunk keys
- API Note:
- currently marked as experimental to gather feedback regarding the returned set being an immutable copy vs it potentially being an unmodifiable view of the set chunks.
-
getSentChunks
Gets the set of chunks that have been sent to the player.- Returns:
- an immutable set of chunks
- API Note:
- currently marked as experimental to gather feedback regarding the returned set being an immutable copy vs it potentially being an unmodifiable view of the set chunks.
-
isChunkSent
Checks if the player has been sent a specific chunk.- Parameters:
chunk
- the chunk to check- Returns:
- true if the player has been sent the chunk, false otherwise
-
isChunkSent
boolean isChunkSent(long chunkKey) Checks if the player has been sent a specific chunk.- Parameters:
chunkKey
- the chunk key to check- Returns:
- true if the player has been sent the chunk, false otherwise
- See Also:
-
spigot
- Specified by:
spigot
in interfaceCommandSender
- Specified by:
spigot
in interfaceEntity
-
sendEntityEffect
Plays an entity effect to this player for the target entityIf the effect is not applicable to this class of entity, it will not play.
- Parameters:
effect
- the entity effecttarget
- the target entity
-
addCustomChatCompletions(Collection)