Package marauroa.common.game
Interface IRPZone
- All Known Implementing Classes:
AdventureIsland
,MarauroaRPZone
,Northpole
,StendhalRPZone
,Vault
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method adds an object to the Zone.void
assignRPObjectID(RPObject object)
Assigns a valid RPObject.ID to the object given as parameterget(RPObject.ID id)
This method returns an object of the Zone.getID()
Returns the ID of the zonegetPerception(RPObject player, byte type)
This method return the perception of a zone for a playerboolean
has(RPObject.ID id)
This method returns true if the object exists in the Zonevoid
Hide an object from the perceptions, but it doesn't remove it from world.iterator()
Iterates over the elements of the zonevoid
This method tag an object of the Zone as modified.void
nextTurn()
This method is called to take zone to the next turnvoid
onFinish()
This method is called when the server finish to save the content of the zonevoid
onInit()
This method is called when the zone is created to popullate itremove(RPObject.ID id)
This method removed an object of the Zone and return it.long
size()
Returns the number of elements of the zonevoid
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
This method is called when the zone is created to popullate it- Throws:
Exception
- if there has been any problem loading zone
-
onFinish
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
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
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
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
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
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
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
This method returns true if the object exists in the Zone- Parameters:
id
- the object identification- Returns:
- true if object exists
-
assignRPObjectID
Assigns a valid RPObject.ID to the object given as parameter- Parameters:
object
- the object
-
iterator
Iterates over the elements of the zone -
size
long size()Returns the number of elements of the zone- Returns:
- the amount of objects that exists in the zone.
-
getPerception
This method return the perception of a zone for a player- Parameters:
player
- player objecttype
- type of perception- Returns:
- the perception
-
nextTurn
void nextTurn()This method is called to take zone to the next turn
-