Added Addon#registerFlag(...) method (#697)

* Add registerFlag method in Addon class that allows to register a new Flag just from Addon class.

This was missing, as request handlers and listeners already has faster methods.

* Update src/main/java/world/bentobox/bentobox/api/addons/Addon.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Update src/main/java/world/bentobox/bentobox/api/addons/Addon.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Use #getPlugin() instead of the getInstance
This commit is contained in:
BONNe 2019-05-24 18:33:54 +03:00 committed by Florian CUNY
parent deee242b90
commit f2877da896

View File

@ -7,6 +7,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Listener;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.request.AddonRequestHandler;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.PlayersManager;
@ -401,4 +402,15 @@ public abstract class Addon {
return null;
}
}
/**
* Register a flag for this addon.
* @param flag the flag to register.
* @return {@code true} if the flag was registered successfully, {@code false} otherwise.
* @since 1.5.0
*/
public boolean registerFlag(Flag flag) {
return getPlugin().getFlagsManager().registerFlag(this, flag);
}
}