Class Server

java.lang.Object
  extended by Server

public class Server
extends java.lang.Object

Server.java - Interface to server stuff


Constructor Summary
Constructor and Description
Server(net.minecraft.server.MinecraftServer server)
          Creates a server
 
Method Summary
Modifier and Type Method and Description
 void addToServerQueue(java.lang.Runnable r)
          Adds a runnable to the Server Queue, so that it will be executed in the Server Thread.
 void addToServerQueue(java.lang.Runnable r, long delayMillis)
          Executes a runnable in the server thread after a specified delay.
 void ban(java.lang.String player)
          Bans specified player
 void dropItem(double x, double y, double z, int itemId)
          Drops an item at the specified location
 void dropItem(double x, double y, double z, int itemId, int quantity)
          Drops an item with desired quantity at the specified location
 void dropItem(Location loc, int itemId)
          Drops an item at the specified location
 void dropItem(Location loc, int itemId, int quantity)
          Drops an item with desired quantity at the specified location
 java.util.List<Mob> getAnimalList()
          Returns the list of animals in all open chunks.
 Block getBlockAt(int x, int y, int z)
          Returns the block at the specified location
 int getBlockData(int x, int y, int z)
          Returns the block data at the specified coordinates
 int getBlockIdAt(int x, int y, int z)
          Returns the block type at the specified location
 java.util.List<Boat> getBoatList()
          Returns the list of boats in all open chunks.
 ComplexBlock getComplexBlock(Block block)
          Returns the complex block at the specified location.
 ComplexBlock getComplexBlock(int x, int y, int z)
          Returns the complex block at the specified location.
 java.util.List<BaseEntity> getEntityList()
          Returns the list of all entities in the server in open chunks.
 int getHighestBlockY(int x, int z)
          Returns the highest block Y
 java.util.List<LivingEntity> getLivingEntityList()
          Returns the list of all living entities (players, animals, mobs) in open chunks.
 net.minecraft.server.MinecraftServer getMCServer()
          Returns the actual Minecraft Server
 java.util.List<Minecart> getMinecartList()
          Returns the list of minecarts in all open chunks.
 java.util.List<Mob> getMobList()
          Returns the list of mobs in all open chunks.
 ComplexBlock getOnlyComplexBlock(Block block)
          Returns the only complex block at the specified location.
 ComplexBlock getOnlyComplexBlock(int x, int y, int z)
          Returns the complex block at the specified location.
 Player getPlayer(java.lang.String name)
          Returns specified player
 java.util.List<Player> getPlayerList()
          Returns the player list.
 long getRelativeTime()
          Returns current server time (0-24000)
 Location getSpawnLocation()
          Get the global spawn location
 long getTime()
          Returns actual server time (-2^63 to 2^63-1)
 java.util.List<BaseVehicle> getVehicleEntityList()
          Returns the list of vehicles in open chunks.
 boolean isBlockIndirectlyPowered(Block block)
          Checks if the provided block is being indirectly powered through redstone
 boolean isBlockIndirectlyPowered(int x, int y, int z)
          Checks if the provided block is being indirectly powered through redstone
 boolean isBlockPowered(Block block)
          Checks if the provided block is being powered through redstone
 boolean isBlockPowered(int x, int y, int z)
          Checks if the provided block is being powered through redstone
 boolean isChunkLoaded(Block block)
          Checks to see whether or not the chunk containing the given block is loaded into memory.
 boolean isChunkLoaded(int x, int y, int z)
          Checks to see whether or not the chunk containing the given block coordinates is loaded into memory.
 boolean isTimerExpired(java.lang.String uniqueString)
          Check to see if your timer has expired yet.
 void loadChunk(Block block)
          Loads the chunk containing the given block.
 void loadChunk(int x, int z)
          Loads the chunk containing the given chunk coordinates.
 void loadChunk(int x, int y, int z)
          Loads the chunk containing the given block coordinates.
 Player matchPlayer(java.lang.String name)
          Tries to match a character's name.
 void messageAll(java.lang.String msg)
          Sends a message to all users
 void saveInventories()
          Saves all player inventories to file
 boolean setBlock(Block block)
          Sets the block
 boolean setBlockAt(int blockType, int x, int y, int z)
          Sets the block type at the specified location
 boolean setBlockData(int x, int y, int z, int data)
          Sets the block data at the specified coordinates
 void setRelativeTime(long time)
          Sets the current server time
 void setTime(long time)
          Sets the actual server time
 void setTimer(java.lang.String uniqueString, int time)
          Starts a timer using the built-in timer system.
 void unban(java.lang.String player)
          Unbans specified user
 void updateBlockPhysics(Block block)
          Forces the server to update the physics for blocks around the given block
 void updateBlockPhysics(int x, int y, int z, int data)
          Forces the server to update the physics for blocks around the given block
 void useConsoleCommand(java.lang.String command)
          Uses the specified console command
 void useConsoleCommand(java.lang.String command, Player player)
          Uses the specified console command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server(net.minecraft.server.MinecraftServer server)
Creates a server

Parameters:
server -
Method Detail

messageAll

public void messageAll(java.lang.String msg)
Sends a message to all users

Parameters:
msg - Message text to send

ban

public void ban(java.lang.String player)
Bans specified player

Parameters:
player - Name of the player to ban

unban

public void unban(java.lang.String player)
Unbans specified user

Parameters:
player - Player name to unban

useConsoleCommand

public void useConsoleCommand(java.lang.String command)
Uses the specified console command

Parameters:
command -

useConsoleCommand

public void useConsoleCommand(java.lang.String command,
                              Player player)
Uses the specified console command

Parameters:
command - command to use
player - player to use command as

setTimer

public void setTimer(java.lang.String uniqueString,
                     int time)
Starts a timer using the built-in timer system.

Parameters:
uniqueString - must be unique identifier for this timer
time - time till it expires (6000 roughly equals 5 minutes)

isTimerExpired

public boolean isTimerExpired(java.lang.String uniqueString)
Check to see if your timer has expired yet.

Parameters:
uniqueString - unique identifier
Returns:
false if timer has expired

getTime

public long getTime()
Returns actual server time (-2^63 to 2^63-1)

Returns:
time server time

getRelativeTime

public long getRelativeTime()
Returns current server time (0-24000)

Returns:
time server time

setTime

public void setTime(long time)
Sets the actual server time

Parameters:
time - time (-2^63 to 2^63-1)

setRelativeTime

public void setRelativeTime(long time)
Sets the current server time

Parameters:
time - time (0-24000)

getMCServer

public net.minecraft.server.MinecraftServer getMCServer()
Returns the actual Minecraft Server

Returns:

matchPlayer

public Player matchPlayer(java.lang.String name)
Tries to match a character's name.

Parameters:
name -
Returns:

getPlayer

public Player getPlayer(java.lang.String name)
Returns specified player

Parameters:
name -
Returns:

getPlayerList

public java.util.List<Player> getPlayerList()
Returns the player list.

Returns:
list of players

getMobList

public java.util.List<Mob> getMobList()
Returns the list of mobs in all open chunks.

Returns:
list of mobs

getAnimalList

public java.util.List<Mob> getAnimalList()
Returns the list of animals in all open chunks.

Returns:
list of animals

getMinecartList

public java.util.List<Minecart> getMinecartList()
Returns the list of minecarts in all open chunks.

Returns:
list of minecarts

getBoatList

public java.util.List<Boat> getBoatList()
Returns the list of boats in all open chunks.

Returns:
list of boats

getEntityList

public java.util.List<BaseEntity> getEntityList()
Returns the list of all entities in the server in open chunks.

Returns:
list of entities

getLivingEntityList

public java.util.List<LivingEntity> getLivingEntityList()
Returns the list of all living entities (players, animals, mobs) in open chunks.

Returns:
list of living entities

getVehicleEntityList

public java.util.List<BaseVehicle> getVehicleEntityList()
Returns the list of vehicles in open chunks.

Returns:
list of vehicles

getSpawnLocation

public Location getSpawnLocation()
Get the global spawn location

Returns:
Location object for spawn

setBlock

public boolean setBlock(Block block)
Sets the block

Parameters:
block -
Returns:

getBlockAt

public Block getBlockAt(int x,
                        int y,
                        int z)
Returns the block at the specified location

Parameters:
x -
y -
z -
Returns:
block

getBlockData

public int getBlockData(int x,
                        int y,
                        int z)
Returns the block data at the specified coordinates

Parameters:
x - x
y - y
z - z
Returns:
block data

setBlockData

public boolean setBlockData(int x,
                            int y,
                            int z,
                            int data)
Sets the block data at the specified coordinates

Parameters:
x - x
y - y
z - z
data - data
Returns:
true if it was successful

setBlockAt

public boolean setBlockAt(int blockType,
                          int x,
                          int y,
                          int z)
Sets the block type at the specified location

Parameters:
blockType -
x -
y -
z -
Returns:
true if successful

getHighestBlockY

public int getHighestBlockY(int x,
                            int z)
Returns the highest block Y

Parameters:
x -
z -
Returns:
highest block altitude

getBlockIdAt

public int getBlockIdAt(int x,
                        int y,
                        int z)
Returns the block type at the specified location

Parameters:
x -
y -
z -
Returns:
block type

getComplexBlock

public ComplexBlock getComplexBlock(Block block)
Returns the complex block at the specified location. Null if there's no complex block there. This will also find complex-blocks spanning multiple spaces, such as double chests.

Parameters:
block -
Returns:
complex block

getComplexBlock

public ComplexBlock getComplexBlock(int x,
                                    int y,
                                    int z)
Returns the complex block at the specified location. Null if there's no complex block there. This will also find complex-blocks spanning multiple spaces, such as double chests.

Parameters:
x - x
y - y
z - z
Returns:
complex block

getOnlyComplexBlock

public ComplexBlock getOnlyComplexBlock(Block block)
Returns the only complex block at the specified location. Null if there's no complex block there.

Parameters:
block -
Returns:
complex block

getOnlyComplexBlock

public ComplexBlock getOnlyComplexBlock(int x,
                                        int y,
                                        int z)
Returns the complex block at the specified location. Null if there's no complex block there.

Parameters:
x - x
y - y
z - z
Returns:
complex block

dropItem

public void dropItem(Location loc,
                     int itemId)
Drops an item at the specified location

Parameters:
loc -
itemId -

dropItem

public void dropItem(double x,
                     double y,
                     double z,
                     int itemId)
Drops an item at the specified location

Parameters:
x -
y -
z -
itemId -

dropItem

public void dropItem(Location loc,
                     int itemId,
                     int quantity)
Drops an item with desired quantity at the specified location

Parameters:
loc -
itemId -
quantity -

dropItem

public void dropItem(double x,
                     double y,
                     double z,
                     int itemId,
                     int quantity)
Drops an item with desired quantity at the specified location

Parameters:
x -
y -
z -
itemId -
quantity -

updateBlockPhysics

public void updateBlockPhysics(Block block)
Forces the server to update the physics for blocks around the given block

Parameters:
block - the block that changed

updateBlockPhysics

public void updateBlockPhysics(int x,
                               int y,
                               int z,
                               int data)
Forces the server to update the physics for blocks around the given block

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

addToServerQueue

public void addToServerQueue(java.lang.Runnable r)
Adds a runnable to the Server Queue, so that it will be executed in the Server Thread.

Parameters:
r - - the runnable

addToServerQueue

public void addToServerQueue(java.lang.Runnable r,
                             long delayMillis)
Executes a runnable in the server thread after a specified delay.

Parameters:
r - - the runnable
delayMillis - - the delay in milliseconds

saveInventories

public void saveInventories()
Saves all player inventories to file


isChunkLoaded

public boolean isChunkLoaded(Block block)
Checks to see whether or not the chunk containing the given block is loaded into memory.

Parameters:
block - the Block to check
Returns:
true if the chunk is loaded

isChunkLoaded

public boolean isChunkLoaded(int x,
                             int y,
                             int z)
Checks to see whether or not the chunk containing the given block coordinates is loaded into memory.

Parameters:
x - a block x-coordinate
y - a block y-coordinate
z - a block z-coordinate
Returns:
true if the chunk is loaded

loadChunk

public void loadChunk(Block block)
Loads the chunk containing the given block. If the chunk does not exist, it will be generated.

Parameters:
block - the Block to check

loadChunk

public void loadChunk(int x,
                      int y,
                      int z)
Loads the chunk containing the given block coordinates. If the chunk does not exist, it will be generated.

Parameters:
x - a block x-coordinate
y - a block y-coordinate
z - a block z-coordinate

loadChunk

public void loadChunk(int x,
                      int z)
Loads the chunk containing the given chunk coordinates. If the chunk does not exist, it will be generated.

Parameters:
x - a chunk x-coordinate
z - a chunk z-coordinate

isBlockPowered

public boolean isBlockPowered(Block block)
Checks if the provided block is being powered through redstone

Parameters:
block - Block to check
Returns:
true if the block is being powered

isBlockPowered

public boolean isBlockPowered(int x,
                              int y,
                              int z)
Checks if the provided block is being powered through redstone

Parameters:
x - a block x-coordinate
y - a block y-coordinate
z - a block z-coordinate
Returns:
true if the block is being powered

isBlockIndirectlyPowered

public boolean isBlockIndirectlyPowered(Block block)
Checks if the provided block is being indirectly powered through redstone

Parameters:
block - Block to check
Returns:
true if the block is being indirectly powered

isBlockIndirectlyPowered

public boolean isBlockIndirectlyPowered(int x,
                                        int y,
                                        int z)
Checks if the provided block is being indirectly powered through redstone

Parameters:
x - a block x-coordinate
y - a block y-coordinate
z - a block z-coordinate
Returns:
true if the block is being indirectly powered