com.mineblown.challengescript.scripting
Class ScriptPlayer

java.lang.Object
  extended by com.mineblown.challengescript.scripting.ScriptPlayer

public class ScriptPlayer
extends java.lang.Object


Field Summary
 java.lang.String displayName
          The player's display name (or nick)
 java.lang.String name
          The name of the player.
 
Constructor Summary
ScriptPlayer(org.bukkit.entity.Player player, com.mineblown.challengescript.challenge.Challenge challenge)
           
 
Method Summary
 void clearInventory()
          Removes all items from the player's inventory.
 void dispatchCommand(java.lang.String command)
          Executes a command for the player.
 ScriptPlayerArmor getArmor()
          Gets the armor of the Player
 java.lang.String getDisplayName()
          Gets the name of the player in the chat
 int getFood()
          Gets the player's food level.
 org.bukkit.craftbukkit.entity.CraftPlayer getHandle()
           
 int getHealth()
          Gets the players current health.
 ScriptLocation getLocation()
          Gets the player's location relative to the challenge spawn.
 int getMaxHealth()
          Gets the maximum health this player can have.
 java.lang.String getName()
          Gets the name of the player
 int getRemainingAir()
          Gets the remaining air bubbles of the player.
 void giveItem(int itemId, int amount)
          Gives the player an item.
 void giveItem(java.lang.String name, int amount)
          Gives the player an item.
 boolean hotbarContains(int itemId)
          Checks if the player has an item with the given id.
 boolean hotbarContains(int itemId, int amount)
          Checks if the player has the specified item with the given amount in his hotbar.
 boolean hotbarContains(java.lang.String name)
          Checks if the player has an item with the given id.
 boolean hotbarContains(java.lang.String name, int amount)
          Checks if the player has the specified item with the given amount in his hotbar.
 boolean inventoryContains(int itemId)
          Checks to see if the player's inventory contains an item.
 boolean inventoryContains(int itemId, int amount)
          Checks to see if the player's inventory contains an amount of items.
 boolean inventoryContains(java.lang.String name)
          Checks to see if the player's inventory contains an item.
 boolean inventoryContains(java.lang.String name, int amount)
          Checks to see if the player's inventory contains an amount of items.
 void playerSoundEffect(java.lang.String name)
          Sends the player a sound effect.
 void playSoundEffect(java.lang.String name, float volume, float pitch)
          Sends the player a sound effect.
 void playVisualEffect(java.lang.String name, double x, double y, double z, int data)
          Sends the player a visual effect.
 void sendMessage(java.lang.String message)
          Sends the player a message in chat.
 void setArmor(ScriptPlayerArmor armor)
          Sets the armor of the player
 void setFood(int food)
          Sets the player's food level.
 void setHealth(int health)
          Sets the players health.
 void setRaining(boolean raining)
          Sets weather to raining or stops raining.
 void setRemainingAir(int remaining)
          Sets the reaming air of the player, when he is under water.
 void setTime(long ticks)
          Sets the time for the player.
 void setTime(java.lang.String name)
          Sets the time for the player.
 void takeItem(int itemId)
          Removes all of an item from the player.
 void takeItem(java.lang.String name)
          Removes all of an item from the player.
 void teleport(double x, double y, double z, float pitch, float yaw)
          Teleports the player to the given coordinates, these are relative to the challenge's spawn point.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
The name of the player.


displayName

public java.lang.String displayName
The player's display name (or nick)

Constructor Detail

ScriptPlayer

public ScriptPlayer(org.bukkit.entity.Player player,
                    com.mineblown.challengescript.challenge.Challenge challenge)
Method Detail

getName

public java.lang.String getName()
Gets the name of the player

Returns:
Name

getDisplayName

public java.lang.String getDisplayName()
Gets the name of the player in the chat

Returns:
Chat name

getHandle

public org.bukkit.craftbukkit.entity.CraftPlayer getHandle()

sendMessage

public void sendMessage(java.lang.String message)
Sends the player a message in chat.

Parameters:
message - The message to send.

getMaxHealth

public int getMaxHealth()
Gets the maximum health this player can have.

Returns:
The maximum health, usually 20.

getHealth

public int getHealth()
Gets the players current health.

Returns:
The health, this is an int between 0 and getMaxHealth()

setHealth

public void setHealth(int health)
Sets the players health.

Parameters:
health - The new health.

getFood

public int getFood()
Gets the player's food level.

Returns:
The food level.

setFood

public void setFood(int food)
Sets the player's food level.

Parameters:
food - The food level.

setRemainingAir

public void setRemainingAir(int remaining)
Sets the reaming air of the player, when he is under water.

Parameters:
remaining - Remaining bubbles of the player (10 is maximum)

getRemainingAir

public int getRemainingAir()
Gets the remaining air bubbles of the player.

Returns:
Number of remaining bubbles.

teleport

public void teleport(double x,
                     double y,
                     double z,
                     float pitch,
                     float yaw)
Teleports the player to the given coordinates, these are relative to the challenge's spawn point.

Parameters:
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.
pitch - The pitch (angle).
yaw - The yaw (direction).

clearInventory

public void clearInventory()
Removes all items from the player's inventory.


inventoryContains

public boolean inventoryContains(int itemId,
                                 int amount)
Checks to see if the player's inventory contains an amount of items.

Parameters:
itemId - The ID of the item.
amount - The amount of the item.
Returns:
True if the items were found, false if not.

inventoryContains

public boolean inventoryContains(int itemId)
Checks to see if the player's inventory contains an item.

Parameters:
itemId - The ID of the item.
Returns:
True if the items were found, false if not.

inventoryContains

public boolean inventoryContains(java.lang.String name,
                                 int amount)
Checks to see if the player's inventory contains an amount of items.

Parameters:
name - The name of the item.
amount - The amount of the item.
Returns:
True if the items were found, false if not.

inventoryContains

public boolean inventoryContains(java.lang.String name)
Checks to see if the player's inventory contains an item.

Parameters:
name - The name of the item.
Returns:
True if the items were found, false if not.

giveItem

public void giveItem(int itemId,
                     int amount)
Gives the player an item.

Parameters:
itemId - The ID of the item to give.
amount - The amount to be given.

giveItem

public void giveItem(java.lang.String name,
                     int amount)
Gives the player an item.

Parameters:
name - The name of the item to give.
amount - The amount to be given.

takeItem

public void takeItem(int itemId)
Removes all of an item from the player.

Parameters:
itemId - The ID of the item to be removed.

takeItem

public void takeItem(java.lang.String name)
Removes all of an item from the player.

Parameters:
name - The name of the item to be removed.

getArmor

public ScriptPlayerArmor getArmor()
Gets the armor of the Player

Returns:
containing all armor parts of the player

setArmor

public void setArmor(ScriptPlayerArmor armor)
Sets the armor of the player

Parameters:
armor - New Armor parts

getLocation

public ScriptLocation getLocation()
Gets the player's location relative to the challenge spawn.

Returns:
The for the player.

playSoundEffect

public void playSoundEffect(java.lang.String name,
                            float volume,
                            float pitch)
Sends the player a sound effect. For a full list of effects see Sound.

Parameters:
name - The name of the effect to send.
volume - The volume of this sound effect.
pitch - The pitch of this sound effect.

playerSoundEffect

public void playerSoundEffect(java.lang.String name)
Sends the player a sound effect. For a full list of effects see Sound.

Parameters:
name - The name of the effect to send.

playVisualEffect

public void playVisualEffect(java.lang.String name,
                             double x,
                             double y,
                             double z,
                             int data)
Sends the player a visual effect.

Parameters:
name - The name of the effect to send.
x - The x coordinate that the effect should be seen at.
y - The x coordinate that the effect should be seen at.
z - The x coordinate that the effect should be seen at.
data - The data for this event, can be 0.

dispatchCommand

public void dispatchCommand(java.lang.String command)
Executes a command for the player.

Parameters:
command - The command to execute.

hotbarContains

public boolean hotbarContains(int itemId,
                              int amount)
Checks if the player has the specified item with the given amount in his hotbar.

Parameters:
itemId - The id of the item.
amount - The minimum amount of the item.
Returns:
True if the hotbar contains such item, false if not.

hotbarContains

public boolean hotbarContains(java.lang.String name,
                              int amount)
Checks if the player has the specified item with the given amount in his hotbar.

Parameters:
name - Name of the.
amount - The minimum amount of the item.
Returns:
True if the hotbar contains such item, false if not.

hotbarContains

public boolean hotbarContains(int itemId)
Checks if the player has an item with the given id.

Parameters:
itemId - Id of the item.
Returns:
True if the item was found, false if not.

hotbarContains

public boolean hotbarContains(java.lang.String name)
Checks if the player has an item with the given id.

Parameters:
name - Name of the item.
Returns:
True if the item was found, false if not.

setRaining

public void setRaining(boolean raining)
Sets weather to raining or stops raining.

Parameters:
raining - True, if it should rain for the player, false if not

setTime

public void setTime(long ticks)
Sets the time for the player.

Parameters:
ticks - The time in server ticks.

setTime

public void setTime(java.lang.String name)
Sets the time for the player.

Parameters:
name - The name representing the time, current values are 'day', 'night', midday' and 'midnight'