Interface IRPZone

All Superinterfaces:
Iterable<RPObject>
All Known Implementing Classes:
AdventureIsland, MarauroaRPZone, Northpole, StendhalRPZone, Vault

public interface IRPZone extends Iterable<RPObject>
Interface for managing the objects in a RPZone. An RPZone is a storage for objects, that has an unique per World associated id. It must provide at least methods for: * adding * removing * querying * modifying It almost provide methods that are called on load and on unload of the zone. And finally it must provide Perception when asked by
Author:
miguel
See Also:
RPServerManager
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    An unique ID for this zone
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add​(RPObject object)
    This method adds an object to the Zone.
    void
    Assigns a valid RPObject.ID to the object given as parameter
    This method returns an object of the Zone.
    Returns the ID of the zone
    getPerception​(RPObject player, byte type)
    This method return the perception of a zone for a player
    boolean
    This method returns true if the object exists in the Zone
    void
    hide​(RPObject object)
    Hide an object from the perceptions, but it doesn't remove it from world.
    Iterates over the elements of the zone
    void
    modify​(RPObject object)
    This method tag an object of the Zone as modified.
    void
    This method is called to take zone to the next turn
    void
    This method is called when the server finish to save the content of the zone
    void
    This method is called when the zone is created to popullate it
    This method removed an object of the Zone and return it.
    long
    Returns the number of elements of the zone
    void
    unhide​(RPObject object)
    Makes a hidden object to be visible again.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • getID

      IRPZone.ID getID()
      Returns the ID of the zone
      Returns:
      zone id
    • onInit

      void onInit() throws Exception
      This method is called when the zone is created to popullate it
      Throws:
      Exception - if there has been any problem loading zone
    • onFinish

      void onFinish() throws Exception
      This method is called when the server finish to save the content of the zone
      Throws:
      Exception - if there has been any problem loading zone
    • add

      void add(RPObject object) throws RPObjectInvalidException
      This method adds an object to the Zone. Object can be modified after this methods and changes are expected to happen too in zone stored object.
      Parameters:
      object - the object
      Throws:
      RPObjectInvalidException - in case the rpobject is invalid for some reason
    • modify

      void modify(RPObject object) throws RPObjectInvalidException
      This method tag an object of the Zone as modified. Object can be modified after this methods and changes are expected to happen too in zone stored object.
      Parameters:
      object - the object
      Throws:
      RPObjectInvalidException - in case the rpobject is invalid for some reason
    • remove

      RPObject remove(RPObject.ID id)
      This method removed an object of the Zone and return it. Object can be modified but it is not longer inside zone.
      Parameters:
      id - the object identification
      Returns:
      the remove object or null if it is not found.
    • hide

      void hide(RPObject object)
      Hide an object from the perceptions, but it doesn't remove it from world. Any further calls to modify will be ignored.
      Parameters:
      object - the object to hide.
    • unhide

      void unhide(RPObject object)
      Makes a hidden object to be visible again. It will appear on the perception as an added object.
      Parameters:
      object - the object to unhide.
    • get

      RPObject get(RPObject.ID id)
      This method returns an object of the Zone. Object can be modified after this methods and changes are expected to happen too in zone stored object.
      Parameters:
      id - the object identification
      Returns:
      the remove object or null if it is not found.
    • has

      boolean has(RPObject.ID id)
      This method returns true if the object exists in the Zone
      Parameters:
      id - the object identification
      Returns:
      true if object exists
    • assignRPObjectID

      void assignRPObjectID(RPObject object)
      Assigns a valid RPObject.ID to the object given as parameter
      Parameters:
      object - the object
    • iterator

      Iterator<RPObject> iterator()
      Iterates over the elements of the zone
      Specified by:
      iterator in interface Iterable<RPObject>
      Returns:
      an iterator over zone
    • size

      long size()
      Returns the number of elements of the zone
      Returns:
      the amount of objects that exists in the zone.
    • getPerception

      Perception getPerception(RPObject player, byte type)
      This method return the perception of a zone for a player
      Parameters:
      player - player object
      type - type of perception
      Returns:
      the perception
    • nextTurn

      void nextTurn()
      This method is called to take zone to the next turn