Developers: Interfaces - JamesNorris/Ablockalypse GitHub Wiki

Interfaces for Developers

Interfaces are perhaps the most useful tool in all of Ablockalypse. You can choose the behavior of your object using these interfaces, and greatly improve Ablockalypse with your add-on.

Interfaces

To add a specific function to your object, you may want to implement the following. They are listed with their function next to them.

Blinkable - Allows the object to blink via the BlinkerThread. Any GameObject assigned objects that are added to a game will start/stop blinking with the other object in the game automatically.

Buyable - Restricts a Powerable object to require purchase first.

GameObject - Allows the object to be added to a game specifically. This is the main interface of the objects used in Ablockalypse, and is highly recommended for those who wish to add on to it.

MapDatable - Allows the object to be saved to a mapdata .objects file. Any GameObject assigned objects that are added to a game will be saved to a .objects file when mapdata is saved for that game.

Permadata - Used for Serializable classes that are linked to Permadatable objects, objects of this type are loaded into a game on startup.

Permadatable - Allows the object to be serialized and loaded on stop and start. Any GameObject assigned objects that are added to a game will be serialized with the game automatically if they implement this interface.

Powerable - Allows the object to be powered on/off. Any GameObject assigned objects that are added to a game will be powered on/off automatically.

Shop - No specific usage as of yet, although this interface is extended by Buyable.

ZADelayedTask - Can be used by MainThread.scheduleDelayedTask() to schedule a delayed task that runs through Ablockalypse. This can also be used to write your own complete delayed task, much like those of the inherent delayed tasks in Ablockalypse.

ZAMob - Allows the object to be added to a game as a mob. ZAMobs can trigger claymores, break barriers, etc.

ZARepeatingTask - Can be used by MainThread.sheduleRepeatingTask() to schedule a repeating task that runs through Ablockalypse. This can also be used to write your own complete repeating task, much like those of the inherent repeating tasks of Ablockalypse, and example being BlinkerThread.class.

ZAScheduledTask - Can be used to schedule either a delayed or repeating task using methods in MainThread.class.

ZAThread - Returned by the scheduled tasks, and can be removed using ZAThread.remove().