Development/Adding Flag
\--[ adding a new flag ]--/
You can find the existing flags in the ZoneFlags class, which is basically only an interface. This interface will be the one we need, you can register you new flag with its static methods..
STEP 1
First of all, create a class, which extends the ZoneFlag class. As it is an abstract class, you are forced to write methods which are needed for all flags. There are some methods, like the onRegisterLoad, which can be overriden, but which are not forced to be. As you created your class, you can register it into Zure:
ZureFlags.registerFlag(new MyFlag());
After registering a new flag, it will call the flag's onRegisterLoad method, which - if it is not overridden - calls the loadData method for all zones fully loaded/buffered at the moment asynchorously [1] |
STEP 2
TO WRITE: Adding mechanics and data handling, save & load.
TIPS
TO WRITE: static listener and flag registration
[1] An asynchorous call means, that the program code is not running on the main thread - slowing the server and its general progress - but on another thread. The effects are not really eyecatching, basically you won't notice any difference. From other threads (called asynchorously), however, you shouldn't call for block modification, because bukkit hates it :) Basically, I don't think, if you need block modification while loading a zone's data... but if you really into it use the bukkit's scheduler and call for a scheduled sync delay with your code. (sync calls - as oppose to async - running on the main thread.)
Comments