Class StendhalRPWorld
java.lang.Object
marauroa.server.game.rp.RPWorld
games.stendhal.server.core.engine.StendhalRPWorld
-
Field Summary
Modifier and TypeFieldDescriptionprotected static StendhalRPWorld
The singleton instance.static String
static int
A common place for milliseconds per turn. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRPZone(String region, StendhalRPZone zone)
Adds a zone to a certain region in this worldstatic StendhalRPWorld
get()
Singleton access method.getAllZonesFromRegion(String region, Boolean exterior, Boolean aboveGround, Boolean accessible)
Retrieves all zones from a specified region with the given flagsstatic StendhalRPWorld
Deprecated.int
getTurnsInSeconds(int seconds)
Gives the number of turns that will take place during a given number of seconds.Finds a zone by its id.Find the zone that would contain an entity at global coordinates.protected void
Initialize the player entry container so RPWorld knows about players.void
onFinish()
This method is called when server is going to shutdown.void
onInit()
This method is called when RPWorld is created by RPServerManagerremoveRPZone(IRPZone.ID zoneid)
Removes a zone from world.void
removeZone(StendhalRPZone toBeRemoved)
protected void
validatePortal(Portal portal)
Methods inherited from class marauroa.server.game.rp.RPWorld
add, addRPZone, changeZone, changeZone, get, getDefaultZone, getRPZone, getRPZone, has, hasRPZone, iterator, modify, nextTurn, remove, removeRPZone, requestSync, setDefaultZone, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
instance
The singleton instance. -
MAPS_FOLDER
-
MILLISECONDS_PER_TURN
public static final int MILLISECONDS_PER_TURNA common place for milliseconds per turn.- See Also:
- Constant Field Values
-
-
Constructor Details
-
StendhalRPWorld
protected StendhalRPWorld()
-
-
Method Details
-
get
Singleton access method.- Returns:
- The static instance.
-
removeRPZone
Description copied from class:RPWorld
Removes a zone from world. It calls zone.onFinish method to free resources zone could have allocated. *- Overrides:
removeRPZone
in classRPWorld
- Returns:
- the zone removed or null if not found
- Throws:
Exception
- caused by onFinish
-
removeZone
-
initialize
protected void initialize()Description copied from class:RPWorld
Initialize the player entry container so RPWorld knows about players.- Overrides:
initialize
in classRPWorld
-
getInstance
Deprecated.useget()
.This method is a workaround for a groovy bug: https://jira.codehaus.org/browse/GROOVY-1484 Don't use it in Java code, only in Groovy. Remove this method once the Groovy bug has been resolved.- Returns:
- StendhalRPWorld
-
getTurnsInSeconds
public int getTurnsInSeconds(int seconds)Gives the number of turns that will take place during a given number of seconds.- Parameters:
seconds
- The number of seconds.- Returns:
- The number of turns.
-
onInit
public void onInit()Description copied from class:RPWorld
This method is called when RPWorld is created by RPServerManager -
onFinish
public void onFinish()Description copied from class:RPWorld
This method is called when server is going to shutdown. -
validatePortal
-
getRPZone
-
getZone
Finds a zone by its id.- Parameters:
id
- The zone's id- Returns:
- The matching zone, or
null
if not found.
-
getZoneAt
Find the zone that would contain an entity at global coordinates. TODO: This is likely broken for entity larger than 2x2, because parts of them will exist in multiple zones (and not in collision)- Parameters:
level
- The level.wx
- The global X coordinate.wy
- The global Y coordinate.entity
- The entity.- Returns:
- The matching zone, or
null
if not found.
-
addRPZone
Adds a zone to a certain region in this world- Parameters:
region
-zone
-
-
getRegions
-
getAllZonesFromRegion
public Collection<StendhalRPZone> getAllZonesFromRegion(String region, Boolean exterior, Boolean aboveGround, Boolean accessible)Retrieves all zones from a specified region with the given flags- Parameters:
region
- the name of the region to search forexterior
- only exterior zones(true), interior zones(false) or all zones (null)aboveGround
- only zones above ground(true), zones below ground(false) or all (null)accessible
- use true to filter out zones that are not accessible for everyone- Returns:
- a list of zones
-
get()
.