com.mineblown.challengescript.scripting
Class ScriptWorld

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

public class ScriptWorld
extends java.lang.Object


Constructor Summary
ScriptWorld(org.bukkit.World world, com.mineblown.challengescript.challenge.Challenge challenge)
           
 
Method Summary
 void closeChest(int x, int y, int z)
          Pretends that the chest at the given coordinates has been closed.
 void dropItem(java.lang.String name, int amount, double x, double y, double z)
          Drops an item in the world.
 ScriptBlock getBlockAt(int x, int y, int z)
          Gets the block at a location.
 java.lang.String getBlockTypeAt(int x, int y, int z)
          Gets the type of block at a location.
 org.bukkit.World getHandle()
           
 ScriptNPC getNPCByID(int id)
          Gets the NPC instance by the NPC ID
 ScriptNPC getNPCByName(java.lang.String name)
          Gets the NPC with the given name.
 void growTree(java.lang.String typeName, int x, int y, int z)
          Grows a tree at the location.
 void openChest(int x, int y, int z)
          Pretends that the chest at the given coordinates has been opened.
 void openChest(java.lang.String forPlayer, int x, int y, int z)
          Pretends that the chest at the given coordinates has been opened.
 void openInventoryView(int x, int y, int z)
          This opens the inventory view for the block at the given coordinates for every player in the challenge.
 void openInventoryView(int x, int y, int z, boolean visual)
          This opens the inventory view for the block at the given position.
 void openInventoryView(java.lang.String forPlayer, int x, int y, int z)
          This opens the inventory view for the block at the given coordinates for the given player.
 void openInventoryView(java.lang.String forPlayer, int x, int y, int z, boolean visual)
          This opens the inventory view for the block at the given coordinates for the given player.
 void removeNPC(int id)
          Completely removes a NPC
 void removeNPC(ScriptNPC npc)
          Completely removes a NPC
 void setBlockAt(int typeId, byte data, int x, int y, int z)
          Sets the block at the given location to the given type and data value.
 void setBlockAt(int typeId, int x, int y, int z)
          Sets the block at the given location to the given type.
 void setBlockAt(java.lang.String name, byte data, int x, int y, int z)
          Sets the block at the given location to the given type and data value.
 void setBlockAt(java.lang.String name, int x, int y, int z)
          Sets the block at the given location to the given type.
 void setRaining(boolean raining)
          Sets the weather for every player in the challenge
 void setTime(long ticks)
          Sets the time in the challenge.
 void setTime(java.lang.String name)
          Sets the time in the challenge
 void shootNamedProjectile(java.lang.String name, int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
          Shoots a projectile from one location to another.
 ScriptEntity[] spawnEntities(java.lang.String name, int x, int y, int z, int amount)
          Spawns a given amount of entities with given type at given position
 ScriptEntity spawnEntity(java.lang.String name, int x, int y, int z)
          Spawns an entity with the given type at given coordinates
 ScriptNPC spawnNPC(java.lang.String name, double x, double y, double z)
          Spawns a NPC with given name at given position
 ScriptNPC spawnNPC(java.lang.String name, ScriptLocation location)
          Spawn a NPC with given name at given location
 void strikeLightning(int x, int y, int z)
          Creates a lightning at the given position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptWorld

public ScriptWorld(org.bukkit.World world,
                   com.mineblown.challengescript.challenge.Challenge challenge)
Method Detail

getBlockAt

public ScriptBlock getBlockAt(int x,
                              int y,
                              int z)
Gets the block at a location.

Parameters:
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.
Returns:
The ScriptBlock at this location.

getBlockTypeAt

public java.lang.String getBlockTypeAt(int x,
                                       int y,
                                       int z)
Gets the type of block at a location.

Parameters:
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.
Returns:
The name of the block type.

setBlockAt

public void setBlockAt(java.lang.String name,
                       int x,
                       int y,
                       int z)
Sets the block at the given location to the given type.

Parameters:
name - The name of the block type to be set.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

setBlockAt

public void setBlockAt(int typeId,
                       int x,
                       int y,
                       int z)
Sets the block at the given location to the given type.

Parameters:
typeId - The ID of the block type to be set.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

setBlockAt

public void setBlockAt(java.lang.String name,
                       byte data,
                       int x,
                       int y,
                       int z)
Sets the block at the given location to the given type and data value.

Parameters:
name - The name of the block type to be set.
data - The data value to be set.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

setBlockAt

public void setBlockAt(int typeId,
                       byte data,
                       int x,
                       int y,
                       int z)
Sets the block at the given location to the given type and data value.

Parameters:
typeId - The ID of the block type to be set.
data - The data value to be set.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

dropItem

public void dropItem(java.lang.String name,
                     int amount,
                     double x,
                     double y,
                     double z)
Drops an item in the world.

Parameters:
name - The name of the item to drop.
amount - The amount of items.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

shootNamedProjectile

public void shootNamedProjectile(java.lang.String name,
                                 int fromX,
                                 int fromY,
                                 int fromZ,
                                 int toX,
                                 int toY,
                                 int toZ)
Shoots a projectile from one location to another.

Parameters:
fromX - The x coordinate to shoot from.
fromY - The y coordinate to shoot from.
fromZ - The z coordinate to shoot from.
toX - The x coordinate to shoot to.
toY - The y coordinate to shoot to.
toZ - The z coordinate to shoot to.

growTree

public void growTree(java.lang.String typeName,
                     int x,
                     int y,
                     int z)
Grows a tree at the location.

Parameters:
typeName - The type of tree to grow.
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.

setTime

public void setTime(long ticks)
Sets the time in the challenge.

Parameters:
ticks - The time in server ticks.

setTime

public void setTime(java.lang.String name)
Sets the time in the challenge

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

spawnNPC

public ScriptNPC spawnNPC(java.lang.String name,
                          double x,
                          double y,
                          double z)
Spawns a NPC with given name at given position

Parameters:
name - Name of the NPC
x - X coordinate
y - Y coordinate
z - Z coordinate
Returns:
instance of the NPC

spawnNPC

public ScriptNPC spawnNPC(java.lang.String name,
                          ScriptLocation location)
Spawn a NPC with given name at given location

Parameters:
name - Name of the NPC
location - Spawn location
Returns:
instance of the NPC

getNPCByID

public ScriptNPC getNPCByID(int id)
Gets the NPC instance by the NPC ID

Parameters:
id - ID of the NPC
Returns:
instance of the NPC

getNPCByName

public ScriptNPC getNPCByName(java.lang.String name)
Gets the NPC with the given name. If there are more NPCs with the same name, anyone of them could be returned.

Parameters:
name - Name of the NPC to search for
Returns:
instance of the first NPC found

removeNPC

public void removeNPC(int id)
Completely removes a NPC

Parameters:
id - ID of the NPC to remove

removeNPC

public void removeNPC(ScriptNPC npc)
Completely removes a NPC

Parameters:
npc - instance of the NPC

openChest

public void openChest(int x,
                      int y,
                      int z)
Pretends that the chest at the given coordinates has been opened. This does NOT open the inventory of the chest. To close it again see closeChest(int, int, int)

Parameters:
x - X coordinate of the chest
y - Y coordinate of the chest
z - Z coordinate of the chest

openChest

public void openChest(java.lang.String forPlayer,
                      int x,
                      int y,
                      int z)
Pretends that the chest at the given coordinates has been opened. This can only be seen by the specified player. This does NOT open the inventory of the chest. To close it again see closeChest(int, int, int)

Parameters:
forPlayer - The player that should only be able to see
x - X coordinate of the chest
y - Y coordinate of the chest
z - Z coordinate of the chest

closeChest

public void closeChest(int x,
                       int y,
                       int z)
Pretends that the chest at the given coordinates has been closed. To open it see openChest(int, int, int)

Parameters:
x - X coordinate of the chest
y - Y coordinate of the chest
z - Z coordinate of the chest

openInventoryView

public void openInventoryView(int x,
                              int y,
                              int z)
This opens the inventory view for the block at the given coordinates for every player in the challenge. If it's a chest and you want to visually open it as well, see openInventoryView(int, int, int, boolean)

Parameters:
x - X coordinate of the block
y - Y coordinate of the block
z - Z coordinate of the block

openInventoryView

public void openInventoryView(java.lang.String forPlayer,
                              int x,
                              int y,
                              int z)
This opens the inventory view for the block at the given coordinates for the given player. If it's a chest and you want to visually open it as well, see openInventoryView(int, int, int, boolean) or openInventoryView(String, int, int, int, boolean)

Parameters:
forPlayer - The player for whom the inventory should open
x - X coordinate of the block
y - Y coordinate of the block
z - Z coordinate of the block

openInventoryView

public void openInventoryView(int x,
                              int y,
                              int z,
                              boolean visual)
This opens the inventory view for the block at the given position. Using this, you can also visually open a chest.

Parameters:
x - X coordinate of the block
y - Y coordinate of the block
z - Z coordinate of the block
visual - True, if the visual animation should be send, false if not

openInventoryView

public void openInventoryView(java.lang.String forPlayer,
                              int x,
                              int y,
                              int z,
                              boolean visual)
This opens the inventory view for the block at the given coordinates for the given player. Unsing this, you can also open it visualy.

Parameters:
forPlayer - The player for whom the inventory should open
x - X coordinate of the block
y - Y coordinate of the block
z - Z coordinate of the block
visual - True, if the visual animation should be send, false if not

setRaining

public void setRaining(boolean raining)
Sets the weather for every player in the challenge

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

strikeLightning

public void strikeLightning(int x,
                            int y,
                            int z)
Creates a lightning at the given position.

Parameters:
x - X coordinate
y - Y coordinate
z - Z coordinate

spawnEntity

public ScriptEntity spawnEntity(java.lang.String name,
                                int x,
                                int y,
                                int z)
Spawns an entity with the given type at given coordinates

Parameters:
name - Type of the entity
x - X coordinate
y - Y coordinate
z - Z coordinate
Returns:
representing the entity spawned

spawnEntities

public ScriptEntity[] spawnEntities(java.lang.String name,
                                    int x,
                                    int y,
                                    int z,
                                    int amount)
Spawns a given amount of entities with given type at given position

Parameters:
name - Type of the entities
x - X coordinate
y - Y coordinate
z - Z coordinate
amount - Amount of entities to spawmn
Returns:
representing the entities spawned

getHandle

public org.bukkit.World getHandle()