Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.entity.Player Interface Reference
Inheritance diagram for org.bukkit.entity.Player:
org.bukkit.entity.HumanEntity org.bukkit.conversations.Conversable org.bukkit.command.CommandSender org.bukkit.OfflinePlayer org.bukkit.plugin.messaging.PluginMessageRecipient org.bukkit.configuration.serialization.ConfigurationSerializable org.bukkit.entity.AnimalTamer org.bukkit.permissions.ServerOperator org.bukkit.permissions.Permissible org.bukkit.inventory.InventoryHolder org.bukkit.permissions.Permissible org.bukkit.entity.AnimalTamer org.bukkit.entity.LivingEntity

Public Member Functions

String getDisplayName ()
 
void setDisplayName (String name)
 
String getPlayerListName ()
 
void setPlayerListName (String name)
 
void setCompassTarget (Location loc)
 
Location getCompassTarget ()
 
InetSocketAddress getAddress ()
 
void sendRawMessage (String message)
 
void kickPlayer (String message)
 
void chat (String msg)
 
boolean performCommand (String command)
 
boolean isSneaking ()
 
void setSneaking (boolean sneak)
 
boolean isSprinting ()
 
void setSprinting (boolean sprinting)
 
void saveData ()
 
void loadData ()
 
void setSleepingIgnored (boolean isSleeping)
 
boolean isSleepingIgnored ()
 
void playNote (Location loc, byte instrument, byte note)
 
void playNote (Location loc, Instrument instrument, Note note)
 
void playSound (Location location, Sound sound, float volume, float pitch)
 
void playSound (Location location, String sound, float volume, float pitch)
 
void playEffect (Location loc, Effect effect, int data)
 
public< T > void playEffect (Location loc, Effect effect, T data)
 
void sendBlockChange (Location loc, Material material, byte data)
 
boolean sendChunkChange (Location loc, int sx, int sy, int sz, byte[] data)
 
void sendBlockChange (Location loc, int material, byte data)
 
void sendSignChange (Location loc, String[] lines) throws IllegalArgumentException
 
void sendMap (MapView map)
 
void updateInventory ()
 
void awardAchievement (Achievement achievement)
 
void removeAchievement (Achievement achievement)
 
boolean hasAchievement (Achievement achievement)
 
void incrementStatistic (Statistic statistic) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic) throws IllegalArgumentException
 
void incrementStatistic (Statistic statistic, int amount) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic, int amount) throws IllegalArgumentException
 
void setStatistic (Statistic statistic, int newValue) throws IllegalArgumentException
 
int getStatistic (Statistic statistic) throws IllegalArgumentException
 
void incrementStatistic (Statistic statistic, Material material) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic, Material material) throws IllegalArgumentException
 
int getStatistic (Statistic statistic, Material material) throws IllegalArgumentException
 
void incrementStatistic (Statistic statistic, Material material, int amount) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic, Material material, int amount) throws IllegalArgumentException
 
void setStatistic (Statistic statistic, Material material, int newValue) throws IllegalArgumentException
 
void incrementStatistic (Statistic statistic, EntityType entityType) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic, EntityType entityType) throws IllegalArgumentException
 
int getStatistic (Statistic statistic, EntityType entityType) throws IllegalArgumentException
 
void incrementStatistic (Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException
 
void decrementStatistic (Statistic statistic, EntityType entityType, int amount)
 
void setStatistic (Statistic statistic, EntityType entityType, int newValue)
 
void setPlayerTime (long time, boolean relative)
 
long getPlayerTime ()
 
long getPlayerTimeOffset ()
 
boolean isPlayerTimeRelative ()
 
void resetPlayerTime ()
 
void setPlayerWeather (WeatherType type)
 
WeatherType getPlayerWeather ()
 
void resetPlayerWeather ()
 
void giveExp (int amount)
 
void giveExpLevels (int amount)
 
float getExp ()
 
void setExp (float exp)
 
int getLevel ()
 
void setLevel (int level)
 
int getTotalExperience ()
 
void setTotalExperience (int exp)
 
float getExhaustion ()
 
void setExhaustion (float value)
 
float getSaturation ()
 
void setSaturation (float value)
 
int getFoodLevel ()
 
void setFoodLevel (int value)
 
Location getBedSpawnLocation ()
 
void setBedSpawnLocation (Location location)
 
void setBedSpawnLocation (Location location, boolean force)
 
boolean getAllowFlight ()
 
void setAllowFlight (boolean flight)
 
void hidePlayer (Player player)
 
void showPlayer (Player player)
 
boolean canSee (Player player)
 
boolean isOnGround ()
 
boolean isFlying ()
 
void setFlying (boolean value)
 
void setFlySpeed (float value) throws IllegalArgumentException
 
void setWalkSpeed (float value) throws IllegalArgumentException
 
float getFlySpeed ()
 
float getWalkSpeed ()
 
void setTexturePack (String url)
 
void setResourcePack (String url)
 
Scoreboard getScoreboard ()
 
void setScoreboard (Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException
 
boolean isHealthScaled ()
 
void setHealthScaled (boolean scale)
 
void setHealthScale (double scale) throws IllegalArgumentException
 
double getHealthScale ()
 
- Public Member Functions inherited from org.bukkit.entity.HumanEntity
String getName ()
 
PlayerInventory getInventory ()
 
Inventory getEnderChest ()
 
boolean setWindowProperty (InventoryView.Property prop, int value)
 
InventoryView getOpenInventory ()
 
InventoryView openInventory (Inventory inventory)
 
InventoryView openWorkbench (Location location, boolean force)
 
InventoryView openEnchanting (Location location, boolean force)
 
void openInventory (InventoryView inventory)
 
void closeInventory ()
 
ItemStack getItemInHand ()
 
void setItemInHand (ItemStack item)
 
ItemStack getItemOnCursor ()
 
void setItemOnCursor (ItemStack item)
 
boolean isSleeping ()
 
int getSleepTicks ()
 
GameMode getGameMode ()
 
void setGameMode (GameMode mode)
 
boolean isBlocking ()
 
int getExpToLevel ()
 
- Public Member Functions inherited from org.bukkit.entity.LivingEntity
double getEyeHeight ()
 
double getEyeHeight (boolean ignoreSneaking)
 
Location getEyeLocation ()
 
List< BlockgetLineOfSight (HashSet< Byte > transparent, int maxDistance)
 
Block getTargetBlock (HashSet< Byte > transparent, int maxDistance)
 
List< BlockgetLastTwoTargetBlocks (HashSet< Byte > transparent, int maxDistance)
 
Egg throwEgg ()
 
Snowball throwSnowball ()
 
Arrow shootArrow ()
 
int getRemainingAir ()
 
void setRemainingAir (int ticks)
 
int getMaximumAir ()
 
void setMaximumAir (int ticks)
 
int getMaximumNoDamageTicks ()
 
void setMaximumNoDamageTicks (int ticks)
 
double getLastDamage ()
 
int _INVALID_getLastDamage ()
 
void setLastDamage (double damage)
 
void _INVALID_setLastDamage (int damage)
 
int getNoDamageTicks ()
 
void setNoDamageTicks (int ticks)
 
Player getKiller ()
 
boolean addPotionEffect (PotionEffect effect)
 
boolean addPotionEffect (PotionEffect effect, boolean force)
 
boolean addPotionEffects (Collection< PotionEffect > effects)
 
boolean hasPotionEffect (PotionEffectType type)
 
void removePotionEffect (PotionEffectType type)
 
Collection< PotionEffectgetActivePotionEffects ()
 
boolean hasLineOfSight (Entity other)
 
boolean getRemoveWhenFarAway ()
 
void setRemoveWhenFarAway (boolean remove)
 
EntityEquipment getEquipment ()
 
void setCanPickupItems (boolean pickup)
 
boolean getCanPickupItems ()
 
void setCustomName (String name)
 
String getCustomName ()
 
void setCustomNameVisible (boolean flag)
 
boolean isCustomNameVisible ()
 
boolean isLeashed ()
 
Entity getLeashHolder () throws IllegalStateException
 
boolean setLeashHolder (Entity holder)
 
- Public Member Functions inherited from org.bukkit.entity.Entity
Location getLocation ()
 
Location getLocation (Location loc)
 
void setVelocity (Vector velocity)
 
Vector getVelocity ()
 
World getWorld ()
 
boolean teleport (Location location)
 
boolean teleport (Location location, TeleportCause cause)
 
boolean teleport (Entity destination)
 
boolean teleport (Entity destination, TeleportCause cause)
 
List< org.bukkit.entity.EntitygetNearbyEntities (double x, double y, double z)
 
int getEntityId ()
 
int getFireTicks ()
 
int getMaxFireTicks ()
 
void setFireTicks (int ticks)
 
void remove ()
 
boolean isDead ()
 
boolean isValid ()
 
Server getServer ()
 
abstract Entity getPassenger ()
 
abstract boolean setPassenger (Entity passenger)
 
abstract boolean isEmpty ()
 
abstract boolean eject ()
 
float getFallDistance ()
 
void setFallDistance (float distance)
 
void setLastDamageCause (EntityDamageEvent event)
 
EntityDamageEvent getLastDamageCause ()
 
UUID getUniqueId ()
 
int getTicksLived ()
 
void setTicksLived (int value)
 
void playEffect (EntityEffect type)
 
EntityType getType ()
 
boolean isInsideVehicle ()
 
boolean leaveVehicle ()
 
Entity getVehicle ()
 
- Public Member Functions inherited from org.bukkit.entity.Damageable
void damage (double amount)
 
void _INVALID_damage (int amount)
 
void damage (double amount, Entity source)
 
void _INVALID_damage (int amount, Entity source)
 
double getHealth ()
 
int _INVALID_getHealth ()
 
void setHealth (double health)
 
void _INVALID_setHealth (int health)
 
double getMaxHealth ()
 
int _INVALID_getMaxHealth ()
 
void setMaxHealth (double health)
 
void _INVALID_setMaxHealth (int health)
 
void resetMaxHealth ()
 
- Public Member Functions inherited from org.bukkit.projectiles.ProjectileSource
public< T extends Projectile > T launchProjectile (Class<?extends T > projectile)
 
public< T extends Projectile > T launchProjectile (Class<?extends T > projectile, Vector velocity)
 
- Public Member Functions inherited from org.bukkit.permissions.Permissible
boolean isPermissionSet (String name)
 
boolean isPermissionSet (Permission perm)
 
boolean hasPermission (String name)
 
boolean hasPermission (Permission perm)
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value)
 
PermissionAttachment addAttachment (Plugin plugin)
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value, int ticks)
 
PermissionAttachment addAttachment (Plugin plugin, int ticks)
 
void removeAttachment (PermissionAttachment attachment)
 
void recalculatePermissions ()
 
Set< PermissionAttachmentInfogetEffectivePermissions ()
 
- Public Member Functions inherited from org.bukkit.permissions.ServerOperator
boolean isOp ()
 
void setOp (boolean value)
 
- Public Member Functions inherited from org.bukkit.conversations.Conversable
boolean isConversing ()
 
void acceptConversationInput (String input)
 
boolean beginConversation (Conversation conversation)
 
void abandonConversation (Conversation conversation)
 
void abandonConversation (Conversation conversation, ConversationAbandonedEvent details)
 
- Public Member Functions inherited from org.bukkit.command.CommandSender
void sendMessage (String message)
 
void sendMessage (String[] messages)
 
Server getServer ()
 
String getName ()
 
- Public Member Functions inherited from org.bukkit.OfflinePlayer
boolean isOnline ()
 
String getName ()
 
UUID getUniqueId ()
 
boolean isBanned ()
 
void setBanned (boolean banned)
 
boolean isWhitelisted ()
 
void setWhitelisted (boolean value)
 
Player getPlayer ()
 
long getFirstPlayed ()
 
long getLastPlayed ()
 
boolean hasPlayedBefore ()
 
- Public Member Functions inherited from org.bukkit.configuration.serialization.ConfigurationSerializable
Map< String, Object > serialize ()
 
- Public Member Functions inherited from org.bukkit.plugin.messaging.PluginMessageRecipient
void sendPluginMessage (Plugin source, String channel, byte[] message)
 
Set< String > getListeningPluginChannels ()
 

Detailed Description

Represents a player, connected or not

Definition at line 25 of file Player.java.

Member Function Documentation

void org.bukkit.entity.Player.awardAchievement ( Achievement  achievement)

Awards the given achievement and any parent achievements that the player does not have.

Parameters
achievementAchievement to award
Exceptions
IllegalArgumentExceptionif achievement is null
boolean org.bukkit.entity.Player.canSee ( Player  player)

Checks to see if a player has been hidden from this player

Parameters
playerPlayer to check
Returns
True if the provided player is not being hidden from this player

Referenced by org.bukkit.command.Command.tabComplete().

void org.bukkit.entity.Player.chat ( String  msg)

Says a message (or runs a command).

Parameters
msgmessage to print
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic) throws IllegalArgumentException

Decrements the given statistic for this player.

This is equivalent to the following code: decrementStatistic(Statistic, 1)

Parameters
statisticStatistic to decrement
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif the statistic requires an additional parameter
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic,
int  amount 
) throws IllegalArgumentException

Decrements the given statistic for this player.

Parameters
statisticStatistic to decrement
amountAmount to decrement this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the statistic requires an additional parameter
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic,
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
statisticStatistic to decrement
materialMaterial to offset the statistic with
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic,
Material  material,
int  amount 
) throws IllegalArgumentException

Decrements the given statistic for this player for the given material.

Parameters
statisticStatistic to decrement
materialMaterial to offset the statistic with
amountAmount to decrement this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic,
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
statisticStatistic to decrement
entityTypeEntityType to offset the statistic with
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.decrementStatistic ( Statistic  statistic,
EntityType  entityType,
int  amount 
)

Decrements the given statistic for this player for the given entity.

Parameters
statisticStatistic to decrement
entityTypeEntityType to offset the statistic with
amountAmount to decrement this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
InetSocketAddress org.bukkit.entity.Player.getAddress ( )

Gets the socket address of this player

Returns
the player's address
boolean org.bukkit.entity.Player.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.
Location org.bukkit.entity.Player.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.

Returns
Bed Spawn Location if bed exists, otherwise null.

Implements org.bukkit.OfflinePlayer.

Location org.bukkit.entity.Player.getCompassTarget ( )

Get the previously set compass target.

Returns
location of the target
String org.bukkit.entity.Player.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
float org.bukkit.entity.Player.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
float org.bukkit.entity.Player.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
float org.bukkit.entity.Player.getFlySpeed ( )

Gets the current allowed speed that a client can fly.

Returns
The current allowed speed, from -1 to 1
int org.bukkit.entity.Player.getFoodLevel ( )

Gets the players current food level

Returns
Food level
double org.bukkit.entity.Player.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
Player::setHealthScale(double)
Player::setHealthScaled(boolean)
int org.bukkit.entity.Player.getLevel ( )

Gets the players current experience level

Returns
Current experience level
String org.bukkit.entity.Player.getPlayerListName ( )

Gets the name that is shown on the player list.

Returns
the player list name
long org.bukkit.entity.Player.getPlayerTime ( )

Returns the player's current timestamp.

Returns
The player's time
long org.bukkit.entity.Player.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
WeatherType org.bukkit.entity.Player.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.
float org.bukkit.entity.Player.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
Scoreboard org.bukkit.entity.Player.getScoreboard ( )

Gets the Scoreboard displayed to this player

Returns
The current scoreboard seen by this player
int org.bukkit.entity.Player.getStatistic ( Statistic  statistic) throws IllegalArgumentException

Gets the value of the given statistic for this player.

Parameters
statisticStatistic to check
Returns
the value of the given statistic
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif the statistic requires an additional parameter
int org.bukkit.entity.Player.getStatistic ( Statistic  statistic,
Material  material 
) throws IllegalArgumentException

Gets the value of the given statistic for this player.

Parameters
statisticStatistic to check
materialMaterial offset of the statistic
Returns
the value of the given statistic
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
int org.bukkit.entity.Player.getStatistic ( Statistic  statistic,
EntityType  entityType 
) throws IllegalArgumentException

Gets the value of the given statistic for this player.

Parameters
statisticStatistic to check
entityTypeEntityType offset of the statistic
Returns
the value of the given statistic
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
int org.bukkit.entity.Player.getTotalExperience ( )

Gets the players total experience points

Returns
Current total experience points
float org.bukkit.entity.Player.getWalkSpeed ( )

Gets the current allowed speed that a client can walk.

Returns
The current allowed speed, from -1 to 1
void org.bukkit.entity.Player.giveExp ( int  amount)

Gives the player the amount of experience specified.

Parameters
amountExp amount to give
void org.bukkit.entity.Player.giveExpLevels ( int  amount)

Gives the player the amount of experience levels specified. Levels can be taken by specifying a negative amount.

Parameters
amountamount of experience levels to give or take
boolean org.bukkit.entity.Player.hasAchievement ( Achievement  achievement)

Gets whether this player has the given achievement.

Returns
whether the player has the achievement
Exceptions
IllegalArgumentExceptionif achievement is null
void org.bukkit.entity.Player.hidePlayer ( Player  player)

Hides a player from this player

Parameters
playerPlayer to hide
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic) throws IllegalArgumentException

Increments the given statistic for this player.

This is equivalent to the following code: incrementStatistic(Statistic, 1)

Parameters
statisticStatistic to increment
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif the statistic requires an additional parameter
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
int  amount 
) throws IllegalArgumentException

Increments the given statistic for this player.

Parameters
statisticStatistic to increment
amountAmount to increment this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the statistic requires an additional parameter
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
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
statisticStatistic to increment
materialMaterial to offset the statistic with
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
Material  material,
int  amount 
) throws IllegalArgumentException

Increments the given statistic for this player for the given material.

Parameters
statisticStatistic to increment
materialMaterial to offset the statistic with
amountAmount to increment this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
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
statisticStatistic to increment
entityTypeEntityType to offset the statistic with
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
EntityType  entityType,
int  amount 
) throws IllegalArgumentException

Increments the given statistic for this player for the given entity.

Parameters
statisticStatistic to increment
entityTypeEntityType to offset the statistic with
amountAmount to increment this statistic by
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif amount is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
boolean org.bukkit.entity.Player.isFlying ( )

Checks to see if this player is currently flying or not.

Returns
True if the player is flying, else false.
boolean org.bukkit.entity.Player.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
Player::setHealthScaled(boolean)
boolean org.bukkit.entity.Player.isOnGround ( )

Checks to see if this player is currently standing on a block. This information may not be reliable, as it is a state provided by the client, and may therefore not be accurate.

Returns
True if the player standing on a solid block, else false.
Deprecated:
Inconsistent with org.bukkit.entity.Entity#isOnGround()

Implements org.bukkit.entity.Entity.

boolean org.bukkit.entity.Player.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.
boolean org.bukkit.entity.Player.isSleepingIgnored ( )

Returns whether the player is sleeping ignored.

Returns
Whether player is ignoring sleep.
boolean org.bukkit.entity.Player.isSneaking ( )

Returns if the player is in sneak mode

Returns
true if player is in sneak mode
boolean org.bukkit.entity.Player.isSprinting ( )

Gets whether the player is sprinting or not.

Returns
true if player is sprinting.
void org.bukkit.entity.Player.kickPlayer ( String  message)

Kicks player with custom kick message.

Parameters
messagekick message
void org.bukkit.entity.Player.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.

boolean org.bukkit.entity.Player.performCommand ( String  command)

Makes the player perform the given command

Parameters
commandCommand to perform
Returns
true if the command was successful, otherwise false
void org.bukkit.entity.Player.playEffect ( Location  loc,
Effect  effect,
int  data 
)

Plays an effect to just this player.

Parameters
locthe location to play the effect at
effectthe Effect
dataa data bit needed for some effects
Deprecated:
Magic value
public<T> void org.bukkit.entity.Player.playEffect ( Location  loc,
Effect  effect,
data 
)

Plays an effect to just this player.

Parameters
locthe location to play the effect at
effectthe Effect
dataa data bit needed for some effects
void org.bukkit.entity.Player.playNote ( Location  loc,
byte  instrument,
byte  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
locThe location of a note block.
instrumentThe instrument ID.
noteThe note ID.
Deprecated:
Magic value
void org.bukkit.entity.Player.playNote ( Location  loc,
Instrument  instrument,
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
locThe location of a note block
instrumentThe instrument
noteThe note
void org.bukkit.entity.Player.playSound ( Location  location,
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
locationThe location to play the sound
soundThe sound to play
volumeThe volume of the sound
pitchThe pitch of the sound
void org.bukkit.entity.Player.playSound ( Location  location,
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
locationthe location to play the sound
soundthe internal sound name to play
volumethe volume of the sound
pitchthe pitch of the sound
Deprecated:
Magic value
void org.bukkit.entity.Player.removeAchievement ( Achievement  achievement)

Removes the given achievement and any children achievements that the player has.

Parameters
achievementAchievement to remove
Exceptions
IllegalArgumentExceptionif achievement is null
void org.bukkit.entity.Player.resetPlayerTime ( )

Restores the normal condition where the player's time is synchronized with the server time.

Equivalent to calling setPlayerTime(0, true).

void org.bukkit.entity.Player.resetPlayerWeather ( )

Restores the normal condition where the player's weather is controlled by server conditions.

void org.bukkit.entity.Player.saveData ( )

Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder

void org.bukkit.entity.Player.sendBlockChange ( Location  loc,
Material  material,
byte  data 
)

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
locThe location of the changed block
materialThe new block
dataThe block data
Deprecated:
Magic value
void org.bukkit.entity.Player.sendBlockChange ( Location  loc,
int  material,
byte  data 
)

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
locThe location of the changed block
materialThe new block ID
dataThe block data
Deprecated:
Magic value
boolean org.bukkit.entity.Player.sendChunkChange ( Location  loc,
int  sx,
int  sy,
int  sz,
byte[]  data 
)

Send 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
locThe location of the cuboid
sxThe x size of the cuboid
syThe y size of the cuboid
szThe z size of the cuboid
dataThe data to be sent
Returns
true if the chunk change packet was sent
Deprecated:
Magic value
void org.bukkit.entity.Player.sendMap ( 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
mapThe map to be sent
void org.bukkit.entity.Player.sendRawMessage ( String  message)

Sends this sender a message raw

Parameters
messageMessage to be displayed

Implements org.bukkit.conversations.Conversable.

void org.bukkit.entity.Player.sendSignChange ( Location  loc,
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 via sendBlockChange(org.bukkit.Location, int, byte) or 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.

Parameters
locthe location of the sign
linesthe new text on the sign or null to clear it
Exceptions
IllegalArgumentExceptionif location is null
IllegalArgumentExceptionif lines is non-null and has a length less than 4
void org.bukkit.entity.Player.setAllowFlight ( boolean  flight)

Sets if the Player is allowed to fly via jump key double-tap like in creative mode.

Parameters
flightIf flight should be allowed.
void org.bukkit.entity.Player.setBedSpawnLocation ( Location  location)

Sets the Location where the player will spawn at their bed.

Parameters
locationwhere to set the respawn location
void org.bukkit.entity.Player.setBedSpawnLocation ( Location  location,
boolean  force 
)

Sets the Location where the player will spawn at their bed.

Parameters
locationwhere to set the respawn location
forcewhether to forcefully set the respawn location even if a valid bed is not present
void org.bukkit.entity.Player.setCompassTarget ( Location  loc)

Set the target of the player's compass.

Parameters
locLocation to point to
void org.bukkit.entity.Player.setDisplayName ( 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
nameThe new display name.
void org.bukkit.entity.Player.setExhaustion ( float  value)

Sets the players current exhaustion level

Parameters
valueExhaustion level
void org.bukkit.entity.Player.setExp ( float  exp)

Sets the players current experience points towards the next level

This is a percentage value. 0 is "no progress" and 1 is "next level".

Parameters
expNew experience points
void org.bukkit.entity.Player.setFlying ( boolean  value)

Makes this player start or stop flying.

Parameters
valueTrue to fly.
void org.bukkit.entity.Player.setFlySpeed ( float  value) throws IllegalArgumentException

Sets the speed at which a client will fly. Negative values indicate reverse directions.

Parameters
valueThe new speed, from -1 to 1.
Exceptions
IllegalArgumentExceptionIf new speed is less than -1 or greater than 1
void org.bukkit.entity.Player.setFoodLevel ( int  value)

Sets the players current food level

Parameters
valueNew food level
void org.bukkit.entity.Player.setHealthScale ( double  scale) throws IllegalArgumentException

Sets the number to scale health to for the client; this will also setHealthScaled(true).

Displayed health follows a simple formula displayedHealth = getHealth() / getMaxHealth() * getHealthScale().

Parameters
scalethe number to scale health to
Exceptions
IllegalArgumentExceptionif scale is <0
IllegalArgumentExceptionif scale is Double#NaN
IllegalArgumentExceptionif scale is too high
void org.bukkit.entity.Player.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
scaleif the client health display is scaled
void org.bukkit.entity.Player.setLevel ( int  level)

Sets the players current experience level

Parameters
levelNew experience level
void org.bukkit.entity.Player.setPlayerListName ( String  name)

Sets the name that is shown on the in-game player list.

The name cannot be longer than 16 characters, but ChatColor is supported.

If the value is null, the name will be identical to 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.

Parameters
namenew player list name
Exceptions
IllegalArgumentExceptionif the name is already used by someone else
IllegalArgumentExceptionif the length of the name is too long
void org.bukkit.entity.Player.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
timeThe current player's perceived time or the player's time offset from the server time.
relativeWhen true the player time is kept relative to its world time.
void org.bukkit.entity.Player.setPlayerWeather ( WeatherType  type)

Sets the type of weather the player will see. When used, the weather status of the player is locked until resetPlayerWeather() is used.

Parameters
typeThe WeatherType enum type the player should experience
void org.bukkit.entity.Player.setResourcePack ( 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 quick timestamp check over the network to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

Notes:

  • Players can disable server resources on their client, in which case this method will have no affect on them.
  • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so.
Parameters
urlThe 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.
Exceptions
IllegalArgumentExceptionThrown if the URL is null.
IllegalArgumentExceptionThrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
void org.bukkit.entity.Player.setSaturation ( float  value)

Sets the players current saturation level

Parameters
valueSaturation level
void org.bukkit.entity.Player.setScoreboard ( Scoreboard  scoreboard) throws IllegalArgumentException, IllegalStateException

Sets the player's visible Scoreboard.

Parameters
scoreboardNew Scoreboard for the player
Exceptions
IllegalArgumentExceptionif scoreboard is null
IllegalArgumentExceptionif scoreboard was not created by the scoreboard manager
IllegalStateExceptionif this is a player that is not logged yet or has logged out
void org.bukkit.entity.Player.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
isSleepingWhether to ignore.
void org.bukkit.entity.Player.setSneaking ( boolean  sneak)

Sets the sneak mode the player

Parameters
sneaktrue if player should appear sneaking
void org.bukkit.entity.Player.setSprinting ( boolean  sprinting)

Sets whether the player is sprinting or not.

Parameters
sprintingtrue if the player should be sprinting
void org.bukkit.entity.Player.setStatistic ( Statistic  statistic,
int  newValue 
) throws IllegalArgumentException

Sets the given statistic for this player.

Parameters
statisticStatistic to set
newValueThe value to set this statistic to
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif newValue is negative
IllegalArgumentExceptionif the statistic requires an additional parameter
void org.bukkit.entity.Player.setStatistic ( Statistic  statistic,
Material  material,
int  newValue 
) throws IllegalArgumentException

Sets the given statistic for this player for the given material.

Parameters
statisticStatistic to set
materialMaterial to offset the statistic with
newValueThe value to set this statistic to
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif material is null
IllegalArgumentExceptionif newValue is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.setStatistic ( Statistic  statistic,
EntityType  entityType,
int  newValue 
)

Sets the given statistic for this player for the given entity.

Parameters
statisticStatistic to set
entityTypeEntityType to offset the statistic with
newValueThe value to set this statistic to
Exceptions
IllegalArgumentExceptionif statistic is null
IllegalArgumentExceptionif entityType is null
IllegalArgumentExceptionif newValue is negative
IllegalArgumentExceptionif the given parameter is not valid for the statistic
void org.bukkit.entity.Player.setTexturePack ( String  url)

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 quick timestamp check over the network 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.
  • There is no concept of resetting texture packs back to default within Minecraft, so players will have to relog to do so.
Parameters
urlThe 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.
Exceptions
IllegalArgumentExceptionThrown if the URL is null.
IllegalArgumentExceptionThrown if the URL is too long.
Deprecated:
Minecraft no longer uses textures packs. Instead you should use setResourcePack(String).
void org.bukkit.entity.Player.setTotalExperience ( int  exp)

Sets the players current experience level

Parameters
expNew experience level
void org.bukkit.entity.Player.setWalkSpeed ( float  value) throws IllegalArgumentException

Sets the speed at which a client will walk. Negative values indicate reverse directions.

Parameters
valueThe new speed, from -1 to 1.
Exceptions
IllegalArgumentExceptionIf new speed is less than -1 or greater than 1
void org.bukkit.entity.Player.showPlayer ( Player  player)

Allows this player to see a player that was previously hidden

Parameters
playerPlayer to show
void org.bukkit.entity.Player.updateInventory ( )

Forces an update of the player's entire inventory.

Deprecated:
This method should not be relied upon as it is a temporary work-around for a larger, more complicated issue.

The documentation for this interface was generated from the following file: