Class StendhalRPWorld
java.lang.Object
marauroa.server.game.rp.RPWorld
games.stendhal.server.core.engine.StendhalRPWorld
- Direct Known Subclasses:
MockStendlRPWorld
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static StendhalRPWorldThe singleton instance.static final Stringstatic final intA common place for milliseconds per turn. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRPZone(String region, StendhalRPZone zone) Adds a zone to a certain region in this worldstatic StendhalRPWorldget()Singleton access method.getAllZonesFromRegion(String region, Boolean exterior, Boolean aboveGround, Boolean accessible) Retrieves all zones from a specified region with the given flagsstatic StendhalRPWorldDeprecated.intgetTurnsInSeconds(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 voidInitialize the player entry container so RPWorld knows about players.voidonFinish()This method is called when server is going to shutdown.voidonInit()This method is called when RPWorld is created by RPServerManagerremoveRPZone(IRPZone.ID zoneid) Removes a zone from world.voidremoveZone(StendhalRPZone toBeRemoved) protected voidvalidatePortal(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, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
instance
The singleton instance. -
MAPS_FOLDER
- See Also:
-
MILLISECONDS_PER_TURN
public static final int MILLISECONDS_PER_TURNA common place for milliseconds per turn.- See Also:
-
-
Constructor Details
-
StendhalRPWorld
protected StendhalRPWorld()
-
-
Method Details
-
get
Singleton access method.- Returns:
- The static instance.
-
removeRPZone
Description copied from class:RPWorldRemoves a zone from world. It calls zone.onFinish method to free resources zone could have allocated. *- Overrides:
removeRPZonein classRPWorld- Returns:
- the zone removed or null if not found
- Throws:
Exception- caused by onFinish
-
removeZone
-
initialize
protected void initialize()Description copied from class:RPWorldInitialize the player entry container so RPWorld knows about players.- Overrides:
initializein 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:RPWorldThis method is called when RPWorld is created by RPServerManager -
onFinish
public void onFinish()Description copied from class:RPWorldThis 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
nullif 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
nullif 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().