AnimalTamer
, Attributable
, CommandSender
, ConfigurationSerializable
, Conversable
, Damageable
, Entity
, HumanEntity
, InventoryHolder
, LivingEntity
, Metadatable
, Nameable
, OfflinePlayer
, Permissible
, PluginMessageRecipient
, ProjectileSource
, ServerOperator
public interface Player extends HumanEntity, Conversable, CommandSender, OfflinePlayer, PluginMessageRecipient
Modifier and Type | Interface | Description |
---|---|---|
static class |
Player.Spigot |
Modifier and Type | Method | Description |
---|---|---|
void |
awardAchievement(Achievement achievement) |
Deprecated.
future versions of Minecraft do not have achievements
|
boolean |
canSee(Player player) |
Checks to see if a player has been hidden from this player
|
void |
chat(java.lang.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.
|
java.net.InetSocketAddress |
getAddress() |
Gets the socket address of this player
|
AdvancementProgress |
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.
|
Location |
getBedSpawnLocation() |
Gets the Location where the player will spawn at their bed, null if
they have not slept in one or their current bed spawn is invalid.
|
Location |
getCompassTarget() |
Get the previously set compass target.
|
java.lang.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 level
|
double |
getHealthScale() |
Gets the number that health is scaled to for the client.
|
int |
getLevel() |
Gets the players current experience level
|
java.lang.String |
getLocale() |
Gets the player's current locale.
|
java.lang.String |
getPlayerListFooter() |
Gets the currently displayed player list footer for this player.
|
java.lang.String |
getPlayerListHeader() |
Gets the currently displayed player list header for this player.
|
java.lang.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 player
|
Entity |
getSpectatorTarget() |
Gets the entity which is followed by the camera when in
GameMode.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 achievements
|
void |
hidePlayer(Player player) |
Deprecated.
|
void |
hidePlayer(Plugin plugin,
Player player) |
Hides a player from this player
|
void |
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 mode
|
boolean |
isSprinting() |
Gets whether the player is sprinting or not.
|
void |
kickPlayer(java.lang.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.
|
boolean |
performCommand(java.lang.String command) |
Makes the player perform the given command
|
void |
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 value
|
void |
playNote(Location loc,
Instrument instrument,
Note note) |
Play a note for a player at a location.
|
void |
playSound(Location location,
java.lang.String sound,
float volume,
float pitch) |
Play a sound for a player at the location.
|
void |
playSound(Location location,
java.lang.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 achievements
|
void |
resetPlayerTime() |
Restores the normal condition where the player's time is synchronized
with the server time.
|
void |
resetPlayerWeather() |
Restores the normal condition where the player's weather is controlled
by server conditions.
|
void |
resetTitle() |
Resets the title displayed to the player.
|
void |
saveData() |
Saves the players current location, health, inventory, motion, and
other information into the username.dat file, in the world/player
folder
|
void |
sendBlockChange(Location loc,
BlockData block) |
Send a block change.
|
void |
sendBlockChange(Location loc,
Material material,
byte data) |
Deprecated.
Magic value
|
boolean |
sendChunkChange(Location loc,
int sx,
int sy,
int sz,
byte[] data) |
Deprecated.
Magic value
|
void |
sendMap(MapView map) |
Render a map and send it to the player in its entirety.
|
void |
sendRawMessage(java.lang.String message) |
Sends this sender a message raw
|
void |
sendSignChange(Location loc,
java.lang.String[] lines) |
Send a sign change.
|
void |
sendTitle(java.lang.String title,
java.lang.String subtitle) |
Deprecated.
API behavior subject to change
|
void |
sendTitle(java.lang.String title,
java.lang.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 |
setBedSpawnLocation(Location location) |
Sets the Location where the player will spawn at their bed.
|
void |
setBedSpawnLocation(Location location,
boolean force) |
Sets the Location where the player will spawn at their bed.
|
void |
setCompassTarget(Location loc) |
Set the target of the player's compass.
|
void |
setDisplayName(java.lang.String name) |
Sets the "friendly" name to display of this player.
|
void |
setExhaustion(float value) |
Sets the players current exhaustion level
|
void |
setExp(float exp) |
Sets the players current experience points towards the next level
|
void |
setFlying(boolean value) |
Makes this player start or stop flying.
|
void |
setFlySpeed(float value) |
Sets the speed at which a client will fly.
|
void |
setFoodLevel(int value) |
Sets the players current food level
|
void |
setHealthScale(double scale) |
Sets the number to scale health to for the client; this will also
setHealthScaled(true) . |
void |
setHealthScaled(boolean scale) |
Sets if the client is displayed a 'scaled' health, that is, health on a
scale from 0-
getHealthScale() . |
void |
setLevel(int level) |
Sets the players current experience level
|
void |
setPlayerListFooter(java.lang.String footer) |
Sets the currently displayed player list footer for this player.
|
void |
setPlayerListHeader(java.lang.String header) |
Sets the currently displayed player list header for this player.
|
void |
setPlayerListHeaderFooter(java.lang.String header,
java.lang.String footer) |
Sets the currently displayed player list header and footer for this
player.
|
void |
setPlayerListName(java.lang.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(java.lang.String url) |
Request that the player's client download and switch resource packs.
|
void |
setResourcePack(java.lang.String url,
byte[] hash) |
Request that the player's client download and switch resource packs.
|
void |
setSaturation(float value) |
Sets the players current saturation level
|
void |
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 player
|
void |
setSpectatorTarget(Entity entity) |
Sets the entity which is followed by the camera when in
GameMode.SPECTATOR . |
void |
setSprinting(boolean sprinting) |
Sets whether the player is sprinting or not.
|
void |
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(java.lang.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(java.lang.String sound) |
Stop the specified sound from playing.
|
void |
stopSound(java.lang.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.
|
getAttribute
sendMessage, sendMessage
serialize
abandonConversation, abandonConversation, acceptConversationInput, beginConversation, isConversing
damage, damage, getHealth, getMaxHealth, resetMaxHealth, setHealth, setMaxHealth
addPassenger, addScoreboardTag, eject, getEntityId, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, 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, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
closeInventory, getCooldown, getEnderChest, getExpToLevel, getGameMode, getInventory, getItemInHand, getItemOnCursor, getMainHand, getName, getOpenInventory, getShoulderEntityLeft, getShoulderEntityRight, getSleepTicks, hasCooldown, isBlocking, isHandRaised, isSleeping, openEnchanting, openInventory, openInventory, openMerchant, openMerchant, openWorkbench, setCooldown, setGameMode, setItemInHand, setItemOnCursor, setShoulderEntityLeft, setShoulderEntityRight, setWindowProperty
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, isRiptiding, isSwimming, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming
getMetadata, hasMetadata, removeMetadata, setMetadata
getCustomName, setCustomName
getFirstPlayed, getLastPlayed, getName, getPlayer, getUniqueId, hasPlayedBefore, isBanned, isOnline, isWhitelisted, setWhitelisted
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
getListeningPluginChannels, sendPluginMessage
launchProjectile, launchProjectile
isOp, setOp
java.lang.String getDisplayName()
Note that this name will not be displayed in game, only in chat and places defined by plugins.
void setDisplayName(java.lang.String name)
Note that this name will not be displayed in game, only in chat and places defined by plugins.
name
- The new display name.java.lang.String getPlayerListName()
void setPlayerListName(java.lang.String name)
The name cannot be longer than 16 characters, but ChatColor
is
supported.
If the value is null, the name will be identical to HumanEntity.getName()
.
This name is case sensitive and unique, two names with different casing will appear as two different people. If a player joins afterwards with a name that conflicts with a player's custom list name, the joining player's player list name will have a random number appended to it (1-2 characters long in the default implementation). If the joining player's name is 15 or 16 characters long, part of the name will be truncated at the end to allow the addition of the two digits.
name
- new player list namejava.lang.IllegalArgumentException
- if the name is already used by someone
elsejava.lang.IllegalArgumentException
- if the length of the name is too longjava.lang.String getPlayerListHeader()
java.lang.String getPlayerListFooter()
void setPlayerListHeader(java.lang.String header)
header
- player list header, null for emptyvoid setPlayerListFooter(java.lang.String footer)
footer
- player list footer, null for emptyvoid setPlayerListHeaderFooter(java.lang.String header, java.lang.String footer)
header
- player list header, null for emptyfooter
- player list footer, null for emptyvoid setCompassTarget(Location loc)
loc
- Location to point toLocation getCompassTarget()
java.net.InetSocketAddress getAddress()
void sendRawMessage(java.lang.String message)
sendRawMessage
in interface Conversable
message
- Message to be displayedvoid kickPlayer(java.lang.String message)
message
- kick messagevoid chat(java.lang.String msg)
msg
- message to printboolean performCommand(java.lang.String command)
command
- Command to performboolean isSneaking()
void setSneaking(boolean sneak)
sneak
- true if player should appear sneakingboolean isSprinting()
void setSprinting(boolean sprinting)
sprinting
- true if the player should be sprintingvoid saveData()
void loadData()
Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file.
void setSleepingIgnored(boolean isSleeping)
isSleeping
- Whether to ignore.boolean isSleepingIgnored()
@Deprecated void playNote(Location loc, byte instrument, byte note)
loc
- The location of a note block.instrument
- The instrument ID.note
- The note ID.void playNote(Location loc, Instrument instrument, Note note)
loc
- The location of a note blockinstrument
- The instrumentnote
- The notevoid playSound(Location location, Sound sound, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(Location location, java.lang.String sound, float volume, float pitch)
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- the location to play the soundsound
- the internal sound name to playvolume
- the volume of the soundpitch
- the pitch of the soundvoid playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(Location location, java.lang.String sound, SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- the location to play the soundsound
- the internal sound name to playcategory
- The category of the soundvolume
- the volume of the soundpitch
- the pitch of the soundvoid stopSound(Sound sound)
sound
- the sound to stopvoid stopSound(java.lang.String sound)
sound
- the sound to stopvoid stopSound(Sound sound, SoundCategory category)
sound
- the sound to stopcategory
- the category of the soundvoid stopSound(java.lang.String sound, SoundCategory category)
sound
- the sound to stopcategory
- the category of the sound@Deprecated void playEffect(Location loc, Effect effect, int data)
loc
- the location to play the effect ateffect
- the Effect
data
- a data bit needed for some effects<T> void playEffect(Location loc, Effect effect, T data)
T
- the data based based on the type of the effectloc
- the location to play the effect ateffect
- the Effect
data
- a data bit needed for some effects@Deprecated void sendBlockChange(Location loc, Material material, byte data)
loc
- The location of the changed blockmaterial
- The new blockdata
- The block datavoid sendBlockChange(Location loc, BlockData block)
loc
- The location of the changed blockblock
- The new block@Deprecated boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data)
At least one of the dimensions of the cuboid must be even. The size of the data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 format.
loc
- The location of the cuboidsx
- The x size of the cuboidsy
- The y size of the cuboidsz
- The z size of the cuboiddata
- The data to be sentvoid sendSignChange(Location loc, java.lang.String[] lines) throws java.lang.IllegalArgumentException
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
loc
- the location of the signlines
- the new text on the sign or null to clear itjava.lang.IllegalArgumentException
- if location is nulljava.lang.IllegalArgumentException
- if lines is non-null and has a length less than 4void sendMap(MapView map)
map
- The map to be sentvoid updateInventory()
@Deprecated void awardAchievement(Achievement achievement)
achievement
- Achievement to awardjava.lang.IllegalArgumentException
- if achievement is null@Deprecated void removeAchievement(Achievement achievement)
achievement
- Achievement to removejava.lang.IllegalArgumentException
- if achievement is null@Deprecated boolean hasAchievement(Achievement achievement)
achievement
- the achievement to checkjava.lang.IllegalArgumentException
- if achievement is nullvoid incrementStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
incrementStatistic(Statistic, 1)
statistic
- Statistic to incrementjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if the statistic requires an
additional parametervoid decrementStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
decrementStatistic(Statistic, 1)
statistic
- Statistic to decrementjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if the statistic requires an
additional parametervoid incrementStatistic(Statistic statistic, int amount) throws java.lang.IllegalArgumentException
statistic
- Statistic to incrementamount
- Amount to increment this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the statistic requires an
additional parametervoid decrementStatistic(Statistic statistic, int amount) throws java.lang.IllegalArgumentException
statistic
- Statistic to decrementamount
- Amount to decrement this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the statistic requires an
additional parametervoid setStatistic(Statistic statistic, int newValue) throws java.lang.IllegalArgumentException
statistic
- Statistic to setnewValue
- The value to set this statistic tojava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if newValue is negativejava.lang.IllegalArgumentException
- if the statistic requires an
additional parameterint getStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
statistic
- Statistic to checkjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if the statistic requires an
additional parametervoid incrementStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
incrementStatistic(Statistic, Material, 1)
statistic
- Statistic to incrementmaterial
- Material to offset the statistic withjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid decrementStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
decrementStatistic(Statistic, Material, 1)
statistic
- Statistic to decrementmaterial
- Material to offset the statistic withjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticint getStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
statistic
- Statistic to checkmaterial
- Material offset of the statisticjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid incrementStatistic(Statistic statistic, Material material, int amount) throws java.lang.IllegalArgumentException
statistic
- Statistic to incrementmaterial
- Material to offset the statistic withamount
- Amount to increment this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid decrementStatistic(Statistic statistic, Material material, int amount) throws java.lang.IllegalArgumentException
statistic
- Statistic to decrementmaterial
- Material to offset the statistic withamount
- Amount to decrement this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid setStatistic(Statistic statistic, Material material, int newValue) throws java.lang.IllegalArgumentException
statistic
- Statistic to setmaterial
- Material to offset the statistic withnewValue
- The value to set this statistic tojava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if material is nulljava.lang.IllegalArgumentException
- if newValue is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid incrementStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
incrementStatistic(Statistic, EntityType, 1)
statistic
- Statistic to incremententityType
- EntityType to offset the statistic withjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid decrementStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
This is equivalent to the following code:
decrementStatistic(Statistic, EntityType, 1)
statistic
- Statistic to decremententityType
- EntityType to offset the statistic withjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticint getStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
statistic
- Statistic to checkentityType
- EntityType offset of the statisticjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws java.lang.IllegalArgumentException
statistic
- Statistic to incremententityType
- EntityType to offset the statistic withamount
- Amount to increment this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid decrementStatistic(Statistic statistic, EntityType entityType, int amount)
statistic
- Statistic to decremententityType
- EntityType to offset the statistic withamount
- Amount to decrement this statistic byjava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if amount is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid setStatistic(Statistic statistic, EntityType entityType, int newValue)
statistic
- Statistic to setentityType
- EntityType to offset the statistic withnewValue
- The value to set this statistic tojava.lang.IllegalArgumentException
- if statistic is nulljava.lang.IllegalArgumentException
- if entityType is nulljava.lang.IllegalArgumentException
- if newValue is negativejava.lang.IllegalArgumentException
- if the given parameter is not valid
for the statisticvoid setPlayerTime(long time, boolean relative)
When using non relative time the player's time will stay fixed at the specified time parameter. It's up to the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime().
time
- The current player's perceived time or the player's time
offset from the server time.relative
- When true the player time is kept relative to its world
time.long getPlayerTime()
long getPlayerTimeOffset()
boolean isPlayerTimeRelative()
void resetPlayerTime()
Equivalent to calling setPlayerTime(0, true).
void setPlayerWeather(WeatherType type)
resetPlayerWeather()
is
used.type
- The WeatherType enum type the player should experienceWeatherType getPlayerWeather()
void resetPlayerWeather()
void giveExp(int amount)
amount
- Exp amount to givevoid giveExpLevels(int amount)
amount
- amount of experience levels to give or takefloat getExp()
This is a percentage value. 0 is "no progress" and 1 is "next level".
void setExp(float exp)
This is a percentage value. 0 is "no progress" and 1 is "next level".
exp
- New experience pointsint getLevel()
void setLevel(int level)
level
- New experience levelint getTotalExperience()
void setTotalExperience(int exp)
exp
- New total experience pointsfloat getExhaustion()
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.
void setExhaustion(float value)
value
- Exhaustion levelfloat getSaturation()
Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.
void setSaturation(float value)
value
- Saturation levelint getFoodLevel()
void setFoodLevel(int value)
value
- New food levelLocation getBedSpawnLocation()
getBedSpawnLocation
in interface OfflinePlayer
void setBedSpawnLocation(Location location)
location
- where to set the respawn locationvoid setBedSpawnLocation(Location location, boolean force)
location
- where to set the respawn locationforce
- whether to forcefully set the respawn location even if a
valid bed is not presentboolean getAllowFlight()
void setAllowFlight(boolean flight)
flight
- If flight should be allowed.@Deprecated void hidePlayer(Player player)
player
- Player to hidevoid hidePlayer(Plugin plugin, Player player)
plugin
- Plugin that wants to hide the playerplayer
- Player to hide@Deprecated void showPlayer(Player player)
player
- Player to showvoid showPlayer(Plugin plugin, Player player)
plugin
- Plugin that wants to show the playerplayer
- Player to showboolean canSee(Player player)
player
- Player to checkboolean isFlying()
void setFlying(boolean value)
value
- True to fly.void setFlySpeed(float value) throws java.lang.IllegalArgumentException
value
- The new speed, from -1 to 1.java.lang.IllegalArgumentException
- If new speed is less than -1 or
greater than 1void setWalkSpeed(float value) throws java.lang.IllegalArgumentException
value
- The new speed, from -1 to 1.java.lang.IllegalArgumentException
- If new speed is less than -1 or
greater than 1float getFlySpeed()
float getWalkSpeed()
@Deprecated void setTexturePack(java.lang.String url)
setResourcePack(String)
.The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the texture
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.java.lang.IllegalArgumentException
- Thrown if the URL is null.java.lang.IllegalArgumentException
- Thrown if the URL is too long.void setResourcePack(java.lang.String url)
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the resource
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.java.lang.IllegalArgumentException
- Thrown if the URL is null.java.lang.IllegalArgumentException
- Thrown if the URL is too long. The
length restriction is an implementation specific arbitrary value.void setResourcePack(java.lang.String url, byte[] hash)
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the resource
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.hash
- The sha1 hash sum of the resource pack file which is used
to apply a cached version of the pack directly without downloading
if it is available. Hast to be 20 bytes long!java.lang.IllegalArgumentException
- Thrown if the URL is null.java.lang.IllegalArgumentException
- Thrown if the URL is too long. The
length restriction is an implementation specific arbitrary value.java.lang.IllegalArgumentException
- Thrown if the hash is null.java.lang.IllegalArgumentException
- Thrown if the hash is not 20 bytes
long.Scoreboard getScoreboard()
void setScoreboard(Scoreboard scoreboard) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
scoreboard
- New Scoreboard for the playerjava.lang.IllegalArgumentException
- if scoreboard is nulljava.lang.IllegalArgumentException
- if scoreboard was not created by the
scoreboard manager
java.lang.IllegalStateException
- if this is a player that is not logged
yet or has logged outboolean isHealthScaled()
getHealthScale()
.setHealthScaled(boolean)
void setHealthScaled(boolean scale)
getHealthScale()
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- if the client health display is scaledvoid setHealthScale(double scale) throws java.lang.IllegalArgumentException
setHealthScaled(true)
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- the number to scale health tojava.lang.IllegalArgumentException
- if scale is <0java.lang.IllegalArgumentException
- if scale is Double.NaN
java.lang.IllegalArgumentException
- if scale is too highdouble getHealthScale()
setHealthScale(double)
,
setHealthScaled(boolean)
Entity getSpectatorTarget()
GameMode.SPECTATOR
.void setSpectatorTarget(Entity entity)
GameMode.SPECTATOR
.entity
- the entity to follow or null to resetjava.lang.IllegalStateException
- if the player is not in
GameMode.SPECTATOR
@Deprecated void sendTitle(java.lang.String title, java.lang.String subtitle)
title
- Title textsubtitle
- Subtitle textvoid sendTitle(java.lang.String title, java.lang.String subtitle, int fadeIn, int stay, int fadeOut)
title
- Title textsubtitle
- Subtitle textfadeIn
- time in ticks for titles to fade in. Defaults to 10.stay
- time in ticks for titles to stay. Defaults to 70.fadeOut
- time in ticks for titles to fade out. Defaults to 20.void resetTitle()
void spawnParticle(Particle particle, Location location, int count)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesvoid spawnParticle(Particle particle, double x, double y, double z, int count)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particles<T> void spawnParticle(Particle particle, Location location, int count, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisvoid spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axis<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
AdvancementProgress getAdvancementProgress(Advancement advancement)
advancement
- advancementjava.lang.String getLocale()
void updateCommands()
Player.Spigot spigot()
spigot
in interface CommandSender
spigot
in interface Entity
Copyright © 2018. All rights reserved.