Interface Player
-
- All Superinterfaces:
AnimalTamer
,Attributable
,CommandSender
,ConfigurationSerializable
,Conversable
,Damageable
,Entity
,HumanEntity
,InventoryHolder
,LivingEntity
,Metadatable
,Nameable
,OfflinePlayer
,Permissible
,PersistentDataHolder
,PluginMessageRecipient
,ProjectileSource
,ServerOperator
public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient
Represents a player, connected or not
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Player.Spigot
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
awardAchievement(Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsboolean
canSee(Player player)
Checks to see if a player has been hidden from this playervoid
chat(String msg)
Says a message (or runs a command).void
decrementStatistic(Statistic statistic)
Decrements the given statistic for this player.void
decrementStatistic(Statistic statistic, int amount)
Decrements the given statistic for this player.void
decrementStatistic(Statistic statistic, EntityType entityType)
Decrements the given statistic for this player for the given entity.void
decrementStatistic(Statistic statistic, EntityType entityType, int amount)
Decrements the given statistic for this player for the given entity.void
decrementStatistic(Statistic statistic, Material material)
Decrements the given statistic for this player for the given material.void
decrementStatistic(Statistic statistic, Material material, int amount)
Decrements the given statistic for this player for the given material.InetSocketAddress
getAddress()
Gets the socket address of this playerAdvancementProgress
getAdvancementProgress(Advancement advancement)
Return the player's progression on the specified advancement.boolean
getAllowFlight()
Determines if the Player is allowed to fly via jump key double-tap like in creative mode.int
getClientViewDistance()
Get the player's current client side view distance.Location
getCompassTarget()
Get the previously set compass target.String
getDisplayName()
Gets the "friendly" name to display of this player.float
getExhaustion()
Gets the players current exhaustion level.float
getExp()
Gets the players current experience points towards the next level.float
getFlySpeed()
Gets the current allowed speed that a client can fly.int
getFoodLevel()
Gets the players current food leveldouble
getHealthScale()
Gets the number that health is scaled to for the client.int
getLevel()
Gets the players current experience levelString
getLocale()
Gets the player's current locale.String
getPlayerListFooter()
Gets the currently displayed player list footer for this player.String
getPlayerListHeader()
Gets the currently displayed player list header for this player.String
getPlayerListName()
Gets the name that is shown on the player list.long
getPlayerTime()
Returns the player's current timestamp.long
getPlayerTimeOffset()
Returns the player's current time offset relative to server time, or the current player's fixed time if the player's time is absolute.WeatherType
getPlayerWeather()
Returns the type of weather the player is currently experiencing.float
getSaturation()
Gets the players current saturation level.Scoreboard
getScoreboard()
Gets the Scoreboard displayed to this playerEntity
getSpectatorTarget()
Gets the entity which is followed by the camera when inGameMode.SPECTATOR
.int
getStatistic(Statistic statistic)
Gets the value of the given statistic for this player.int
getStatistic(Statistic statistic, EntityType entityType)
Gets the value of the given statistic for this player.int
getStatistic(Statistic statistic, Material material)
Gets the value of the given statistic for this player.int
getTotalExperience()
Gets the players total experience points.float
getWalkSpeed()
Gets the current allowed speed that a client can walk.void
giveExp(int amount)
Gives the player the amount of experience specified.void
giveExpLevels(int amount)
Gives the player the amount of experience levels specified.boolean
hasAchievement(Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsvoid
hidePlayer(Player player)
Deprecated.void
hidePlayer(Plugin plugin, Player player)
Hides a player from this playervoid
incrementStatistic(Statistic statistic)
Increments the given statistic for this player.void
incrementStatistic(Statistic statistic, int amount)
Increments the given statistic for this player.void
incrementStatistic(Statistic statistic, EntityType entityType)
Increments the given statistic for this player for the given entity.void
incrementStatistic(Statistic statistic, EntityType entityType, int amount)
Increments the given statistic for this player for the given entity.void
incrementStatistic(Statistic statistic, Material material)
Increments the given statistic for this player for the given material.void
incrementStatistic(Statistic statistic, Material material, int amount)
Increments the given statistic for this player for the given material.boolean
isFlying()
Checks to see if this player is currently flying or not.boolean
isHealthScaled()
Gets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale()
.boolean
isPlayerTimeRelative()
Returns true if the player's time is relative to the server time, otherwise the player's time is absolute and will not change its current time unless done so with setPlayerTime().boolean
isSleepingIgnored()
Returns whether the player is sleeping ignored.boolean
isSneaking()
Returns if the player is in sneak modeboolean
isSprinting()
Gets whether the player is sprinting or not.void
kickPlayer(String message)
Kicks player with custom kick message.void
loadData()
Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder.void
openBook(ItemStack book)
Open aMaterial.WRITTEN_BOOK
for a Playerboolean
performCommand(String command)
Makes the player perform the given commandvoid
playEffect(Location loc, Effect effect, int data)
Deprecated.Magic value<T> void
playEffect(Location loc, Effect effect, T data)
Plays an effect to just this player.void
playNote(Location loc, byte instrument, byte note)
Deprecated.Magic valuevoid
playNote(Location loc, Instrument instrument, Note note)
Play a note for a player at a location.void
playSound(Location location, String sound, float volume, float pitch)
Play a sound for a player at the location.void
playSound(Location location, String sound, SoundCategory category, float volume, float pitch)
Play a sound for a player at the location.void
playSound(Location location, Sound sound, float volume, float pitch)
Play a sound for a player at the location.void
playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch)
Play a sound for a player at the location.void
removeAchievement(Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsvoid
resetPlayerTime()
Restores the normal condition where the player's time is synchronized with the server time.void
resetPlayerWeather()
Restores the normal condition where the player's weather is controlled by server conditions.void
resetTitle()
Resets the title displayed to the player.void
saveData()
Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player foldervoid
sendBlockChange(Location loc, BlockData block)
Send a block change.void
sendBlockChange(Location loc, Material material, byte data)
Deprecated.Magic valueboolean
sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data)
Deprecated.Magic valuevoid
sendMap(MapView map)
Render a map and send it to the player in its entirety.void
sendRawMessage(String message)
Sends this sender a message rawvoid
sendSignChange(Location loc, String[] lines)
Send a sign change.void
sendSignChange(Location loc, String[] lines, DyeColor dyeColor)
Send a sign change.void
sendTitle(String title, String subtitle)
Deprecated.API behavior subject to changevoid
sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut)
Sends a title and a subtitle message to the player.void
setAllowFlight(boolean flight)
Sets if the Player is allowed to fly via jump key double-tap like in creative mode.void
setCompassTarget(Location loc)
Set the target of the player's compass.void
setDisplayName(String name)
Sets the "friendly" name to display of this player.void
setExhaustion(float value)
Sets the players current exhaustion levelvoid
setExp(float exp)
Sets the players current experience points towards the next levelvoid
setFlying(boolean value)
Makes this player start or stop flying.void
setFlySpeed(float value)
Sets the speed at which a client will fly.void
setFoodLevel(int value)
Sets the players current food levelvoid
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 levelvoid
setPlayerListFooter(String footer)
Sets the currently displayed player list footer for this player.void
setPlayerListHeader(String header)
Sets the currently displayed player list header for this player.void
setPlayerListHeaderFooter(String header, String footer)
Sets the currently displayed player list header and footer for this player.void
setPlayerListName(String name)
Sets the name that is shown on the in-game player list.void
setPlayerTime(long time, boolean relative)
Sets the current time on the player's client.void
setPlayerWeather(WeatherType type)
Sets the type of weather the player will see.void
setResourcePack(String url)
Request that the player's client download and switch resource packs.void
setResourcePack(String url, byte[] hash)
Request that the player's client download and switch resource packs.void
setSaturation(float value)
Sets the players current saturation levelvoid
setScoreboard(Scoreboard scoreboard)
Sets the player's visible Scoreboard.void
setSleepingIgnored(boolean isSleeping)
Sets whether the player is ignored as not sleeping.void
setSneaking(boolean sneak)
Sets the sneak mode the playervoid
setSpectatorTarget(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
setStatistic(Statistic statistic, int newValue)
Sets the given statistic for this player.void
setStatistic(Statistic statistic, EntityType entityType, int newValue)
Sets the given statistic for this player for the given entity.void
setStatistic(Statistic statistic, Material material, int newValue)
Sets the given statistic for this player for the given material.void
setTexturePack(String url)
Deprecated.Minecraft no longer uses textures packs.void
setTotalExperience(int exp)
Sets the players current experience points.void
setWalkSpeed(float value)
Sets the speed at which a client will walk.void
showPlayer(Player player)
Deprecated.void
showPlayer(Plugin plugin, Player player)
Allows this player to see a player that was previously hidden.void
spawnParticle(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(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(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(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(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(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(Particle particle, Location location, int count)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(Particle particle, 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(Particle particle, 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(Particle particle, 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(Particle particle, 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(Particle particle, Location location, int count, T data)
Spawns the particle (the number of times specified by count) at the target location.Player.Spigot
spigot()
void
stopSound(String sound)
Stop the specified sound from playing.void
stopSound(String sound, SoundCategory category)
Stop the specified sound from playing.void
stopSound(Sound sound)
Stop the specified sound from playing.void
stopSound(Sound sound, SoundCategory category)
Stop the specified sound from playing.void
updateCommands()
Update the list of commands sent to the client.void
updateInventory()
Forces an update of the player's entire inventory.-
Methods inherited from interface org.bukkit.attribute.Attributable
getAttribute
-
Methods inherited from interface org.bukkit.command.CommandSender
sendMessage, sendMessage
-
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Methods inherited from interface org.bukkit.conversations.Conversable
abandonConversation, abandonConversation, acceptConversationInput, beginConversation, isConversing
-
Methods inherited from interface org.bukkit.entity.Damageable
damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
-
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, eject, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isOnGround, isPersistent, isSilent, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
-
Methods inherited from interface org.bukkit.entity.HumanEntity
closeInventory, discoverRecipe, discoverRecipes, getBedLocation, getBedSpawnLocation, getCooldown, getEnderChest, getExpToLevel, getGameMode, getInventory, getItemInHand, getItemOnCursor, getMainHand, getName, getOpenInventory, getShoulderEntityLeft, getShoulderEntityRight, getSleepTicks, hasCooldown, isBlocking, isHandRaised, openEnchanting, openInventory, openInventory, openMerchant, openMerchant, openWorkbench, setBedSpawnLocation, setBedSpawnLocation, setCooldown, setGameMode, setItemInHand, setItemOnCursor, setShoulderEntityLeft, setShoulderEntityRight, setWindowProperty, sleep, undiscoverRecipe, undiscoverRecipes, wakeup
-
Methods inherited from interface org.bukkit.entity.LivingEntity
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming
-
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
-
Methods inherited from interface org.bukkit.Nameable
getCustomName, setCustomName
-
Methods inherited from interface org.bukkit.OfflinePlayer
getBedSpawnLocation, getFirstPlayed, getLastPlayed, getName, getPlayer, getUniqueId, hasPlayedBefore, isBanned, isOnline, isWhitelisted, setWhitelisted
-
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, 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 org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile
-
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
-
-
-
Method Detail
-
getDisplayName
@NotNull String getDisplayName()
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
void setDisplayName(@Nullable String name)
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.
-
getPlayerListName
@NotNull String getPlayerListName()
Gets the name that is shown on the player list.- Returns:
- the player list name
-
setPlayerListName
void setPlayerListName(@Nullable String name)
Sets the name that is shown on the in-game player list.If the value is null, the name will be identical to
HumanEntity.getName()
.- Parameters:
name
- new player list name
-
getPlayerListHeader
@Nullable String getPlayerListHeader()
Gets the currently displayed player list header for this player.- Returns:
- player list header or null
-
getPlayerListFooter
@Nullable String getPlayerListFooter()
Gets the currently displayed player list footer for this player.- Returns:
- player list header or null
-
setPlayerListHeader
void setPlayerListHeader(@Nullable String header)
Sets the currently displayed player list header for this player.- Parameters:
header
- player list header, null for empty
-
setPlayerListFooter
void setPlayerListFooter(@Nullable String footer)
Sets the currently displayed player list footer for this player.- Parameters:
footer
- player list footer, null for empty
-
setPlayerListHeaderFooter
void setPlayerListHeaderFooter(@Nullable String header, @Nullable String footer)
Sets the currently displayed player list header and footer for this player.- Parameters:
header
- player list header, null for emptyfooter
- player list footer, null for empty
-
setCompassTarget
void setCompassTarget(@NotNull Location loc)
Set the target of the player's compass.- Parameters:
loc
- Location to point to
-
getCompassTarget
@NotNull Location getCompassTarget()
Get the previously set compass target.- Returns:
- location of the target
-
getAddress
@Nullable InetSocketAddress getAddress()
Gets the socket address of this player- Returns:
- the player's address
-
sendRawMessage
void sendRawMessage(@NotNull String message)
Sends this sender a message raw- Specified by:
sendRawMessage
in interfaceConversable
- Parameters:
message
- Message to be displayed
-
kickPlayer
void kickPlayer(@Nullable String message)
Kicks player with custom kick message.- Parameters:
message
- kick message
-
chat
void chat(@NotNull String msg)
Says a message (or runs a command).- Parameters:
msg
- message to print
-
performCommand
boolean performCommand(@NotNull String command)
Makes the player perform the given command- Parameters:
command
- Command to perform- Returns:
- true if the command was successful, otherwise false
-
isSneaking
boolean isSneaking()
Returns if the player is in sneak mode- Returns:
- true if player is in sneak mode
-
setSneaking
void setSneaking(boolean sneak)
Sets the sneak mode the player- 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 username.dat file, in the world/player folder
-
loadData
void loadData()
Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player 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.
-
playNote
@Deprecated void playNote(@NotNull Location loc, byte instrument, byte note)
Deprecated.Magic valuePlay a note for a player at a location. This requires a note block at the particular location (as far as the client is concerned). This will not work without a note block. This will not work with cake.- Parameters:
loc
- The location of a note block.instrument
- The instrument ID.note
- The note ID.
-
playNote
void playNote(@NotNull Location loc, @NotNull Instrument instrument, @NotNull Note note)
Play a note for a player at a location. This requires a note block at the particular location (as far as the client is concerned). This will not work without a note block. This will not work with cake.- Parameters:
loc
- The location of a note blockinstrument
- The instrumentnote
- The note
-
playSound
void playSound(@NotNull Location location, @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 Location location, @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 Location location, @NotNull Sound sound, @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 Location location, @NotNull String sound, @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
-
stopSound
void stopSound(@NotNull Sound sound)
Stop the specified sound from playing.- Parameters:
sound
- the sound to stop
-
stopSound
void stopSound(@NotNull String sound)
Stop the specified sound from playing.- Parameters:
sound
- the sound to stop
-
stopSound
void stopSound(@NotNull Sound sound, @Nullable SoundCategory category)
Stop the specified sound from playing.- Parameters:
sound
- the sound to stopcategory
- the category of the sound
-
stopSound
void stopSound(@NotNull String sound, @Nullable SoundCategory category)
Stop the specified sound from playing.- Parameters:
sound
- the sound to stopcategory
- the category of the sound
-
playEffect
@Deprecated void playEffect(@NotNull Location loc, @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 Location loc, @NotNull Effect effect, @Nullable T data)
Plays an effect to just this player.- Type Parameters:
T
- the data based 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
-
sendBlockChange
@Deprecated void sendBlockChange(@NotNull Location loc, @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
void sendBlockChange(@NotNull Location loc, @NotNull BlockData block)
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
-
sendChunkChange
@Deprecated boolean sendChunkChange(@NotNull Location loc, int sx, int sy, int sz, @NotNull byte[] data)
Deprecated.Magic valueSend a chunk change. This fakes a chunk change packet for a user at a certain location. The updated cuboid must be entirely within a single chunk. This will not actually change the world in any way.At least one of the dimensions of the cuboid must be even. The size of the data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 format.
- Parameters:
loc
- The location of the cuboidsx
- The x size of the cuboidsy
- The y size of the cuboidsz
- The z size of the cuboiddata
- The data to be sent- Returns:
- true if the chunk change packet was sent
-
sendSignChange
void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException
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
void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException
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
-
sendMap
void sendMap(@NotNull MapView map)
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
-
updateInventory
void updateInventory()
Forces an update of the player's entire inventory.
-
awardAchievement
@Deprecated void awardAchievement(@NotNull Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsAwards the given achievement and any parent achievements that the player does not have.- Parameters:
achievement
- Achievement to award- Throws:
IllegalArgumentException
- if achievement is null
-
removeAchievement
@Deprecated void removeAchievement(@NotNull Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsRemoves the given achievement and any children achievements that the player has.- Parameters:
achievement
- Achievement to remove- Throws:
IllegalArgumentException
- if achievement is null
-
hasAchievement
@Deprecated boolean hasAchievement(@NotNull Achievement achievement)
Deprecated.future versions of Minecraft do not have achievementsGets whether this player has the given achievement.- Parameters:
achievement
- the achievement to check- Returns:
- whether the player has the achievement
- Throws:
IllegalArgumentException
- if achievement is null
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException
Increments the given statistic for this player.This is equivalent to the following code:
incrementStatistic(Statistic, 1)
- Parameters:
statistic
- Statistic to increment- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException
Decrements the given statistic for this player.This is equivalent to the following code:
decrementStatistic(Statistic, 1)
- Parameters:
statistic
- Statistic to decrement- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException
Increments the given statistic for this player.- Parameters:
statistic
- Statistic to incrementamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException
Decrements the given statistic for this player.- Parameters:
statistic
- Statistic to decrementamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
setStatistic
void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException
Sets the given statistic for this player.- Parameters:
statistic
- Statistic to setnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the statistic requires an additional parameter
-
getStatistic
int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to check- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if the statistic requires an additional parameter
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException
Increments the given statistic for this player for the given material.This is equivalent to the following code:
incrementStatistic(Statistic, Material, 1)
- Parameters:
statistic
- Statistic to incrementmaterial
- Material to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException
Decrements the given statistic for this player for the given material.This is equivalent to the following code:
decrementStatistic(Statistic, Material, 1)
- Parameters:
statistic
- Statistic to decrementmaterial
- Material to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
getStatistic
int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to checkmaterial
- Material offset of the statistic- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException
Increments the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to incrementmaterial
- Material to offset the statistic withamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException
Decrements the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to decrementmaterial
- Material to offset the statistic withamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
setStatistic
void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException
Sets the given statistic for this player for the given material.- Parameters:
statistic
- Statistic to setmaterial
- Material to offset the statistic withnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if material is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException
Increments the given statistic for this player for the given entity.This is equivalent to the following code:
incrementStatistic(Statistic, EntityType, 1)
- Parameters:
statistic
- Statistic to incremententityType
- EntityType to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException
Decrements the given statistic for this player for the given entity.This is equivalent to the following code:
decrementStatistic(Statistic, EntityType, 1)
- Parameters:
statistic
- Statistic to decremententityType
- EntityType to offset the statistic with- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
getStatistic
int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException
Gets the value of the given statistic for this player.- Parameters:
statistic
- Statistic to checkentityType
- EntityType offset of the statistic- Returns:
- the value of the given statistic
- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if the given parameter is not valid for the statistic
-
incrementStatistic
void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException
Increments the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to incremententityType
- EntityType to offset the statistic withamount
- Amount to increment this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
decrementStatistic
void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount)
Decrements the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to decremententityType
- EntityType to offset the statistic withamount
- Amount to decrement this statistic by- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if amount is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
setStatistic
void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue)
Sets the given statistic for this player for the given entity.- Parameters:
statistic
- Statistic to setentityType
- EntityType to offset the statistic withnewValue
- The value to set this statistic to- Throws:
IllegalArgumentException
- if statistic is nullIllegalArgumentException
- if entityType is nullIllegalArgumentException
- if newValue is negativeIllegalArgumentException
- if the given parameter is not valid for the statistic
-
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
void setPlayerWeather(@NotNull WeatherType type)
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
@Nullable WeatherType 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
void giveExp(int amount)
Gives the player the amount of experience specified.- Parameters:
amount
- Exp amount to give
-
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 only displayed as the player's "score" upon dying.- 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 only displayed as the player's "score" upon dying.- Parameters:
exp
- New total experience points
-
getExhaustion
float getExhaustion()
Gets the players current exhaustion level.Exhaustion controls how fast the food level drops. While you have a certain amount of exhaustion, your saturation will drop to zero, and then your food will drop to zero.
- Returns:
- Exhaustion level
-
setExhaustion
void setExhaustion(float value)
Sets the players current exhaustion level- Parameters:
value
- Exhaustion level
-
getSaturation
float getSaturation()
Gets the players current saturation level.Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.
- Returns:
- Saturation level
-
setSaturation
void setSaturation(float value)
Sets the players current saturation level- Parameters:
value
- Saturation level
-
getFoodLevel
int getFoodLevel()
Gets the players current food level- Returns:
- Food level
-
setFoodLevel
void setFoodLevel(int value)
Sets the players current food level- Parameters:
value
- New food level
-
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.
-
hidePlayer
@Deprecated void hidePlayer(@NotNull Player player)
Deprecated.Hides a player from this player- Parameters:
player
- Player to hide
-
hidePlayer
void hidePlayer(@NotNull Plugin plugin, @NotNull Player player)
Hides a player from this player- Parameters:
plugin
- Plugin that wants to hide the playerplayer
- Player to hide
-
showPlayer
@Deprecated void showPlayer(@NotNull Player player)
Deprecated.Allows this player to see a player that was previously hidden- Parameters:
player
- Player to show
-
showPlayer
void showPlayer(@NotNull Plugin plugin, @NotNull Player player)
Allows this player to see a player that was previously hidden. If another 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
boolean canSee(@NotNull Player player)
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
-
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
void setFlySpeed(float value) throws IllegalArgumentException
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
void setWalkSpeed(float value) throws IllegalArgumentException
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 void setTexturePack(@NotNull String url)
Deprecated.Minecraft no longer uses textures packs. Instead you should usesetResourcePack(String)
.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! - There is no concept of resetting texture packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty 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
void setResourcePack(@NotNull String url)
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! - There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty 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 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
void setResourcePack(@NotNull String url, @NotNull byte[] hash)
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. 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! - There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
- 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 null.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
-
getScoreboard
@NotNull Scoreboard getScoreboard()
Gets the Scoreboard displayed to this player- Returns:
- The current scoreboard seen by this player
-
setScoreboard
void setScoreboard(@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
-
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(boolean)
-
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
void setHealthScale(double scale) throws IllegalArgumentException
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:
setHealthScale(double)
,setHealthScaled(boolean)
-
getSpectatorTarget
@Nullable Entity 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
void setSpectatorTarget(@Nullable Entity entity)
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 void sendTitle(@Nullable String title, @Nullable String subtitle)
Deprecated.API behavior subject to changeSends 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
void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut)
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.
-
spawnParticle
void spawnParticle(@NotNull Particle particle, @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
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.- 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 Particle particle, @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 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 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. 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 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 Particle particle, @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 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 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. 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 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 Particle particle, @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 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()
-
getAdvancementProgress
@NotNull AdvancementProgress getAdvancementProgress(@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
-
getLocale
@NotNull String getLocale()
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
-
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
void openBook(@NotNull ItemStack book)
Open aMaterial.WRITTEN_BOOK
for a Player- Parameters:
book
- The book to open for this player
-
spigot
@NotNull Player.Spigot spigot()
- Specified by:
spigot
in interfaceCommandSender
- Specified by:
spigot
in interfaceEntity
-
-