Class StendhalRPWorld

java.lang.Object
marauroa.server.game.rp.RPWorld
games.stendhal.server.core.engine.StendhalRPWorld
All Implemented Interfaces:
Iterable<IRPZone>

public class StendhalRPWorld extends RPWorld
  • Field Details

    • instance

      protected static StendhalRPWorld instance
      The singleton instance.
    • MAPS_FOLDER

      public static final String MAPS_FOLDER
    • MILLISECONDS_PER_TURN

      public static final int MILLISECONDS_PER_TURN
      A common place for milliseconds per turn.
      See Also:
      Constant Field Values
  • Constructor Details

    • StendhalRPWorld

      protected StendhalRPWorld()
  • Method Details

    • get

      public static StendhalRPWorld get()
      Singleton access method.
      Returns:
      The static instance.
    • removeRPZone

      public IRPZone removeRPZone(IRPZone.ID zoneid) throws Exception
      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 class RPWorld
      Returns:
      the zone removed or null if not found
      Throws:
      Exception - caused by onFinish
    • removeZone

      public void removeZone(StendhalRPZone toBeRemoved)
    • initialize

      protected void initialize()
      Description copied from class: RPWorld
      Initialize the player entry container so RPWorld knows about players.
      Overrides:
      initialize in class RPWorld
    • getInstance

      @Deprecated public static StendhalRPWorld getInstance()
      Deprecated.
      use get().
      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
      Overrides:
      onInit in class RPWorld
    • onFinish

      public void onFinish()
      Description copied from class: RPWorld
      This method is called when server is going to shutdown.
      Overrides:
      onFinish in class RPWorld
    • validatePortal

      protected void validatePortal(Portal portal)
    • getRPZone

      public IRPZone getRPZone(String zone)
    • getZone

      public StendhalRPZone getZone(String id)
      Finds a zone by its id.
      Parameters:
      id - The zone's id
      Returns:
      The matching zone, or null if not found.
    • getZoneAt

      public StendhalRPZone getZoneAt(int level, int wx, int wy, Entity entity)
      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

      public void addRPZone(String region, StendhalRPZone zone)
      Adds a zone to a certain region in this world
      Parameters:
      region -
      zone -
    • getRegions

      public TreeSet<String> 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 for
      exterior - 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