Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.entity.Player Interface Reference

Represents a player, connected or not. More...

+ Inheritance diagram for org.bukkit.entity.Player:
+ Collaboration diagram for org.bukkit.entity.Player:

Public Member Functions

String getDisplayName ()
 Gets the "friendly" name to display of this player.
 
void setDisplayName (String name)
 Sets the "friendly" name to display of this player.
 
String getPlayerListName ()
 Gets the name that is shown on the player list.
 
void setPlayerListName (String name)
 Sets the name that is shown on the in-game player list.
 
void setCompassTarget (Location loc)
 Set the target of the player's compass.
 
Location getCompassTarget ()
 Get the previously set compass target.
 
InetSocketAddress getAddress ()
 Gets the socket address of this player.
 
void sendRawMessage (String message)
 Sends this sender a message raw.
 
void kickPlayer (String message)
 Kicks player with custom kick message.
 
void chat (String msg)
 Says a message (or runs a command).
 
boolean performCommand (String command)
 Makes the player perform the given command.
 
boolean isSneaking ()
 Returns if the player is in sneak mode.
 
void setSneaking (boolean sneak)
 Sets the sneak mode the player.
 
boolean isSprinting ()
 Gets whether the player is sprinting or not.
 
void setSprinting (boolean sprinting)
 Sets whether the player is sprinting or not.
 
void saveData ()
 Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder.
 
void loadData ()
 Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder.
 
void setSleepingIgnored (boolean isSleeping)
 Sets whether the player is ignored as not sleeping.
 
boolean isSleepingIgnored ()
 Returns whether the player is sleeping ignored.
 
void playNote (Location loc, byte instrument, byte note)
 Play a note for a player at a location.
 
void playNote (Location loc, Instrument instrument, Note note)
 Play a note for a player at a location.
 
void playSound (Location location, Sound sound, float volume, float pitch)
 Play a sound for a player at the location.
 
void playEffect (Location loc, Effect effect, int data)
 Plays an effect to just this player.
 
public< T > void playEffect (Location loc, Effect effect, T data)
 Plays an effect to just this player.
 
void sendBlockChange (Location loc, Material material, byte data)
 Send a block change.
 
boolean sendChunkChange (Location loc, int sx, int sy, int sz, byte[] data)
 Send a chunk change.
 
void sendBlockChange (Location loc, int material, byte data)
 Send a block change.
 
void sendMap (MapView map)
 Render a map and send it to the player in its entirety.
 
void updateInventory ()
 Forces an update of the player's entire inventory.
 
void awardAchievement (Achievement achievement)
 Awards this player the given achievement.
 
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, 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.
 
void setPlayerTime (long time, boolean relative)
 Sets the current time on the player's client.
 
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.
 
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().
 
void resetPlayerTime ()
 Restores the normal condition where the player's time is synchronized with the server time.
 
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.
 
float getExp ()
 Gets the players current experience points towards the next level.
 
void setExp (float exp)
 Sets the players current experience points towards the next level.
 
int getLevel ()
 Gets the players current experience level.
 
void setLevel (int level)
 Sets the players current experience level.
 
int getTotalExperience ()
 Gets the players total experience points.
 
void setTotalExperience (int exp)
 Sets the players current experience level.
 
float getExhaustion ()
 Gets the players current exhaustion level.
 
void setExhaustion (float value)
 Sets the players current exhaustion level.
 
float getSaturation ()
 Gets the players current saturation level.
 
void setSaturation (float value)
 Sets the players current saturation level.
 
int getFoodLevel ()
 Gets the players current food level.
 
void setFoodLevel (int value)
 Sets the players current food level.
 
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.
 
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.
 
boolean getAllowFlight ()
 Determines if the Player is allowed to fly via jump key double-tap like in creative mode.
 
void setAllowFlight (boolean flight)
 Sets if the Player is allowed to fly via jump key double-tap like in creative mode.
 
void hidePlayer (Player player)
 Hides a player from this player.
 
void showPlayer (Player player)
 Allows this player to see a player that was previously hidden.
 
boolean canSee (Player player)
 Checks to see if a player has been hidden from this player.
 
boolean isFlying ()
 Checks to see if this player is currently flying or not.
 
void setFlying (boolean value)
 Makes this player start or stop flying.
 
void setFlySpeed (float value) throws IllegalArgumentException
 Sets the speed at which a client will fly.
 
void setWalkSpeed (float value) throws IllegalArgumentException
 Sets the speed at which a client will walk.
 
float getFlySpeed ()
 Gets the current allowed speed that a client can fly.
 
float getWalkSpeed ()
 Gets the current allowed speed that a client can walk.
 
void setTexturePack (String url)
 Request that the player's client download and switch texture packs.
 
- Public Member Functions inherited from org.bukkit.entity.HumanEntity
String getName ()
 Returns the name of this player.
 
PlayerInventory getInventory ()
 Get the player's inventory.
 
Inventory getEnderChest ()
 Get the player's EnderChest inventory.
 
boolean setWindowProperty (InventoryView.Property prop, int value)
 If the player currently has an inventory window open, this method will set a property of that window, such as the state of a progress bar.
 
InventoryView getOpenInventory ()
 Gets the inventory view the player is currently viewing.
 
InventoryView openInventory (Inventory inventory)
 Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.
 
InventoryView openWorkbench (Location location, boolean force)
 Opens an empty workbench inventory window with the player's inventory on the bottom.
 
InventoryView openEnchanting (Location location, boolean force)
 Opens an empty enchanting inventory window with the player's inventory on the bottom.
 
void openInventory (InventoryView inventory)
 Opens an inventory window to the specified inventory view.
 
void closeInventory ()
 Force-closes the currently open inventory view for this player, if any.
 
ItemStack getItemInHand ()
 Returns the ItemStack currently in your hand, can be empty.
 
void setItemInHand (ItemStack item)
 Sets the item to the given ItemStack, this will replace whatever the user was holding.
 
ItemStack getItemOnCursor ()
 Returns the ItemStack currently on your cursor, can be empty.
 
void setItemOnCursor (ItemStack item)
 Sets the item to the given ItemStack, this will replace whatever the user was moving.
 
boolean isSleeping ()
 Returns whether this player is slumbering.
 
int getSleepTicks ()
 Get the sleep ticks of the player.
 
GameMode getGameMode ()
 Gets this humans current GameMode.
 
void setGameMode (GameMode mode)
 Sets this humans current GameMode.
 
boolean isBlocking ()
 Check if the player is currently blocking (ie with a sword).
 
int getExpToLevel ()
 Get the total amount of experience required for the player to level.
 
- Public Member Functions inherited from org.bukkit.entity.LivingEntity
double getEyeHeight ()
 Gets the height of the entity's head above its Location.
 
double getEyeHeight (boolean ignoreSneaking)
 Gets the height of the entity's head above its Location.
 
Location getEyeLocation ()
 Get a Location detailing the current eye position of the LivingEntity.
 
List< BlockgetLineOfSight (HashSet< Byte > transparent, int maxDistance)
 Gets all blocks along the player's line of sight List iterates from player's position to target inclusive.
 
Block getTargetBlock (HashSet< Byte > transparent, int maxDistance)
 Gets the block that the player has targeted.
 
List< BlockgetLastTwoTargetBlocks (HashSet< Byte > transparent, int maxDistance)
 Gets the last two blocks along the player's line of sight.
 
Egg throwEgg ()
 Throws an egg from the entity.
 
Snowball throwSnowball ()
 Throws a snowball from the entity.
 
Arrow shootArrow ()
 Shoots an arrow from the entity.
 
public< T extends Projectile > T launchProjectile (Class<?extends T > projectile)
 Launches a Projectile from the entity.
 
int getRemainingAir ()
 Returns the amount of air that this entity has remaining, in ticks.
 
void setRemainingAir (int ticks)
 Sets the amount of air that this entity has remaining, in ticks.
 
int getMaximumAir ()
 Returns the maximum amount of air this entity can have, in ticks.
 
void setMaximumAir (int ticks)
 Sets the maximum amount of air this entity can have, in ticks.
 
int getMaximumNoDamageTicks ()
 Returns the entities current maximum noDamageTicks This is the time in ticks the entity will become unable to take equal or less damage than the lastDamage.
 
void setMaximumNoDamageTicks (int ticks)
 Sets the entities current maximum noDamageTicks.
 
int getLastDamage ()
 Returns the entities lastDamage taken in the current noDamageTicks time.
 
void setLastDamage (int damage)
 Sets the entities current maximum noDamageTicks.
 
int getNoDamageTicks ()
 Returns the entities current noDamageTicks.
 
void setNoDamageTicks (int ticks)
 Sets the entities current noDamageTicks.
 
Player getKiller ()
 Gets the player identified as the killer of this entity.
 
boolean addPotionEffect (PotionEffect effect)
 Adds the given PotionEffect to this entity.
 
boolean addPotionEffect (PotionEffect effect, boolean force)
 Adds the given PotionEffect to this entity.
 
boolean addPotionEffects (Collection< PotionEffect > effects)
 Attempts to add all of the given PotionEffect to this entity.
 
boolean hasPotionEffect (PotionEffectType type)
 Returns whether the entity already has an existing effect of the given PotionEffectType applied to it.
 
void removePotionEffect (PotionEffectType type)
 Removes any effects present of the given PotionEffectType.
 
Collection< PotionEffectgetActivePotionEffects ()
 Returns all currently active PotionEffects on this entity.
 
boolean hasLineOfSight (Entity other)
 Checks whether the entity has block line of sight to another.
 
boolean getRemoveWhenFarAway ()
 Returns if the entity despawns when away from players or not.
 
void setRemoveWhenFarAway (boolean remove)
 Sets whether or not the entity despawns when away from players or not.
 
EntityEquipment getEquipment ()
 Gets the inventory with the equipment worn by this entity.
 
void setCanPickupItems (boolean pickup)
 Sets whether or not the entity can pick up items.
 
boolean getCanPickupItems ()
 Gets if the entity can pick up items.
 
- Public Member Functions inherited from org.bukkit.entity.Entity
Location getLocation ()
 Gets the entity's current position.
 
Location getLocation (Location loc)
 Stores the entity's current position in the provided Location object.
 
void setVelocity (Vector velocity)
 Sets this entity's velocity.
 
Vector getVelocity ()
 Gets this entity's current velocity.
 
World getWorld ()
 Gets the current world this entity resides in.
 
boolean teleport (Location location)
 Teleports this entity to the given location.
 
boolean teleport (Location location, TeleportCause cause)
 Teleports this entity to the given location.
 
boolean teleport (Entity destination)
 Teleports this entity to the target Entity.
 
boolean teleport (Entity destination, TeleportCause cause)
 Teleports this entity to the target Entity.
 
List< org.bukkit.entity.EntitygetNearbyEntities (double x, double y, double z)
 Returns a list of entities within a bounding box centered around this entity.
 
int getEntityId ()
 Returns a unique id for this entity.
 
int getFireTicks ()
 Returns the entity's current fire ticks (ticks before the entity stops being on fire).
 
int getMaxFireTicks ()
 Returns the entity's maximum fire ticks.
 
void setFireTicks (int ticks)
 Sets the entity's current fire ticks (ticks before the entity stops being on fire).
 
void remove ()
 Mark the entity's removal.
 
boolean isDead ()
 Returns true if this entity has been marked for removal.
 
boolean isValid ()
 Returns false if the entity has died or been despawned for some other reason.
 
Server getServer ()
 Gets the Server that contains this Entity.
 
abstract Entity getPassenger ()
 Gets the primary passenger of a vehicle.
 
abstract boolean setPassenger (Entity passenger)
 Set the passenger of a vehicle.
 
abstract boolean isEmpty ()
 Check if a vehicle has passengers.
 
abstract boolean eject ()
 Eject any passenger.
 
float getFallDistance ()
 Returns the distance this entity has fallen.
 
void setFallDistance (float distance)
 Sets the fall distance for this entity.
 
void setLastDamageCause (EntityDamageEvent event)
 Record the last EntityDamageEvent inflicted on this entity.
 
EntityDamageEvent getLastDamageCause ()
 Retrieve the last EntityDamageEvent inflicted on this entity.
 
UUID getUniqueId ()
 Returns a unique and persistent id for this entity.
 
int getTicksLived ()
 Gets the amount of ticks this entity has lived for.
 
void setTicksLived (int value)
 Sets the amount of ticks this entity has lived for.
 
void playEffect (EntityEffect type)
 Performs the specified EntityEffect for this entity.
 
EntityType getType ()
 Get the type of the entity.
 
boolean isInsideVehicle ()
 Returns whether this entity is inside a vehicle.
 
boolean leaveVehicle ()
 Leave the current vehicle.
 
Entity getVehicle ()
 Get the vehicle that this player is inside.
 
- Public Member Functions inherited from org.bukkit.entity.Damageable
void damage (int amount)
 Deals the given amount of damage to this entity.
 
void damage (int amount, Entity source)
 Deals the given amount of damage to this entity, from a specified entity.
 
int getHealth ()
 Gets the entity's health from 0 to getMaxHealth(), where 0 is dead.
 
void setHealth (int health)
 Sets the entity's health from 0 to getMaxHealth(), where 0 is dead.
 
int getMaxHealth ()
 Gets the maximum health this entity has.
 
void setMaxHealth (int health)
 Sets the maximum health this entity can have.
 
void resetMaxHealth ()
 Resets the max health to the original amount.
 
- Public Member Functions inherited from org.bukkit.entity.AnimalTamer
String getName ()
 This is the name of the specified AnimalTamer.
 
- Public Member Functions inherited from org.bukkit.permissions.Permissible
boolean isPermissionSet (String name)
 Checks if this object contains an override for the specified permission, by fully qualified name.
 
boolean isPermissionSet (Permission perm)
 Checks if this object contains an override for the specified Permission.
 
boolean hasPermission (String name)
 Gets the value of the specified permission, if set.
 
boolean hasPermission (Permission perm)
 Gets the value of the specified permission, if set.
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value)
 Adds a new PermissionAttachment with a single permission by name and value.
 
PermissionAttachment addAttachment (Plugin plugin)
 Adds a new empty PermissionAttachment to this object.
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value, int ticks)
 Temporarily adds a new PermissionAttachment with a single permission by name and value.
 
PermissionAttachment addAttachment (Plugin plugin, int ticks)
 Temporarily adds a new empty PermissionAttachment to this object.
 
void removeAttachment (PermissionAttachment attachment)
 Removes the given PermissionAttachment from this object.
 
void recalculatePermissions ()
 Recalculates the permissions for this object, if the attachments have changed values.
 
Set< PermissionAttachmentInfogetEffectivePermissions ()
 Gets a set containing all of the permissions currently in effect by this object.
 
- Public Member Functions inherited from org.bukkit.permissions.ServerOperator
boolean isOp ()
 Checks if this object is a server operator.
 
void setOp (boolean value)
 Sets the operator status of this object.
 
- Public Member Functions inherited from org.bukkit.inventory.InventoryHolder
Inventory getInventory ()
 Get the object's inventory.
 
- Public Member Functions inherited from org.bukkit.conversations.Conversable
boolean isConversing ()
 Tests to see of a Conversable object is actively engaged in a conversation.
 
void acceptConversationInput (String input)
 Accepts input into the active conversation.
 
boolean beginConversation (Conversation conversation)
 Enters into a dialog with a Conversation object.
 
void abandonConversation (Conversation conversation)
 Abandons an active conversation.
 
void abandonConversation (Conversation conversation, ConversationAbandonedEvent details)
 Abandons an active conversation.
 
void sendRawMessage (String message)
 Sends this sender a message raw.
 
- Public Member Functions inherited from org.bukkit.command.CommandSender
void sendMessage (String message)
 Sends this sender a message.
 
void sendMessage (String[] messages)
 Sends this sender multiple messages.
 
Server getServer ()
 Returns the server instance that this command is running on.
 
String getName ()
 Gets the name of this command sender.
 
- Public Member Functions inherited from org.bukkit.OfflinePlayer
boolean isOnline ()
 Checks if this player is currently online.
 
String getName ()
 Returns the name of this player.
 
boolean isBanned ()
 Checks if this player is banned or not.
 
void setBanned (boolean banned)
 Bans or unbans this player.
 
boolean isWhitelisted ()
 Checks if this player is whitelisted or not.
 
void setWhitelisted (boolean value)
 Sets if this player is whitelisted or not.
 
Player getPlayer ()
 Gets a Player object that this represents, if there is one.
 
long getFirstPlayed ()
 Gets the first date and time that this player was witnessed on this server.
 
long getLastPlayed ()
 Gets the last date and time that this player was witnessed on this server.
 
boolean hasPlayedBefore ()
 Checks if this player has played on this server before.
 
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.
 
- Public Member Functions inherited from org.bukkit.plugin.messaging.PluginMessageRecipient
void sendPluginMessage (Plugin source, String channel, byte[] message)
 Sends this recipient a Plugin Message on the specified outgoing channel.
 
Set< String > getListeningPluginChannels ()
 Gets a set containing all the Plugin Channels that this client is listening on.
 

Detailed Description

Represents a player, connected or not.

Definition at line 23 of file Player.java.

Member Function Documentation

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

Awards this player the given achievement.

Parameters
achievementAchievement to award
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.defaults.OpCommand.tabComplete(), and org.bukkit.command.Command.tabComplete().

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

Says a message (or runs a command).

Parameters
msgmessage to print
InetSocketAddress org.bukkit.entity.Player.getAddress ( )

Gets the socket address of this player.

Returns
the player's address

Referenced by org.bukkit.command.defaults.BanIpCommand.execute().

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.
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

Referenced by org.bukkit.command.defaults.SpawnpointCommand.execute(), org.bukkit.command.defaults.TeleportCommand.execute(), and org.bukkit.command.defaults.ClearCommand.execute().

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
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
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
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

Referenced by org.bukkit.command.defaults.ExpCommand.execute().

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

Referenced by org.bukkit.command.defaults.ExpCommand.execute().

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)

Increments the given statistic for this player.

Parameters
statisticStatistic to increment
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
int  amount 
)

Increments the given statistic for this player.

Parameters
statisticStatistic to increment
amountAmount to increment this statistic by
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
Material  material 
)

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

Parameters
statisticStatistic to increment
materialMaterial to offset the statistic with
void org.bukkit.entity.Player.incrementStatistic ( Statistic  statistic,
Material  material,
int  amount 
)

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
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.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

Referenced by org.bukkit.command.defaults.BanCommand.execute(), and org.bukkit.command.defaults.KickCommand.execute().

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
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.
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.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.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
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
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
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 desirbale.

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
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

Referenced by org.bukkit.command.defaults.SpawnpointCommand.execute().

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.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.setSaturation ( float  value)

Sets the players current saturation level.

Parameters
valueExhaustion level
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.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.
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: