Marauroa Core API: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
imported>Hendrik Brummermann
Line 216: Line 216:
onInit and onFinish are called on server startup and finalization. You need to subclass RPWorld to give proper behaviour to them.
onInit and onFinish are called on server startup and finalization. You need to subclass RPWorld to give proper behaviour to them.


<source lang="java">
public void onInit() throws Exception
public void onFinish() throws Exception
public void onInit() throws Exception
public void onFinish() throws Exception
</source>


Some helper methods to add zones and iterate them.
Some helper methods to add zones and iterate them.


<source lang="java">
public void addRPZone(IRPZone zone)
public IRPZone getRPZone(IRPZone.ID zoneid)
public void addRPZone(IRPZone zone)
public IRPZone getRPZone(RPObject.ID objectid)
public IRPZone getRPZone(IRPZone.ID zoneid)
public Iterator<IRPZone> iterator()
public IRPZone getRPZone(RPObject.ID objectid)
public int size()
public Iterator<IRPZone> iterator()
public int size()
</source>


Methods to add,get,test existence, remove and modify objects.
Methods to add, get, test existence, remove and modify objects. modify() is as you know for delta^2 algorithm.
Modify is as you know for delta^2 algorithm.


<source lang="java">
public void add(RPObject object) throws NoRPZoneException, RPObjectInvalidException
public RPObject get(RPObject.ID id) throws NoRPZoneException, RPObjectInvalidException
public void add(RPObject object) throws NoRPZoneException, RPObjectInvalidException
public boolean has(RPObject.ID id) throws NoRPZoneException, RPObjectInvalidException
public RPObject get(RPObject.ID id) throws NoRPZoneException, RPObjectInvalidException
public RPObject remove(RPObject.ID id) throws NoRPZoneException, RPObjectNotFoundException
public boolean has(RPObject.ID id) throws NoRPZoneException, RPObjectInvalidException
public void modify(RPObject object) throws NoRPZoneException
public RPObject remove(RPObject.ID id) throws NoRPZoneException, RPObjectNotFoundException
public void modify(RPObject object) throws NoRPZoneException
</source>


These are helper methods for changing the zone of an object. Use them instead of doing it by hand.
These are helper methods for changing the zone of an object. Use them instead of doing it by hand.


<source lang="java">
public void changeZone(IRPZone.ID oldzoneid, IRPZone.ID newzoneid, RPObject object) throws NoRPZoneException
public void changeZone(String oldzone, String newzone, RPObject object) throws NoRPZoneException
public void changeZone(IRPZone.ID oldzoneid, IRPZone.ID newzoneid, RPObject object) throws NoRPZoneException
public void changeZone(String oldzone, String newzone, RPObject object) throws NoRPZoneException
</source>


=IRPZone=
=IRPZone=