Package com.vk2gpz.tokenenchant.api
Class Addon
java.lang.Object
com.vk2gpz.tokenenchant.api.Addon
- All Implemented Interfaces:
com.vk2gpz.mc.event.EventMapper,org.bukkit.event.Listener
public abstract class Addon
extends Object
implements org.bukkit.event.Listener, com.vk2gpz.mc.event.EventMapper
This is an abstract class to be extended in order to provide various functions for TokenEnchant.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoiddoHelp(org.bukkit.command.CommandSender sender) If this custom enchantment/potion has a command, you can provide its help description in this method.static voidstatic Collection<Addon> static AddongetAddonWithID(String id) protected org.bukkit.ChatColorgetAllowed(org.bukkit.permissions.Permissible p, String perm) A utility method to return a chat color based on whether the specified player has the specified permission or not.protected org.bukkit.configuration.file.FileConfigurationThis method returns the pair of evnet name and its process priority for this CE.protected StringgetID()static Stringprotected StringgetName()Returns the simplified class name.protected Stringprotected StringReturns the version of this custom enchantmentprotected static booleanA utility method to return whether the specified player has the specified permission or not.protected booleanisMyCommand(org.bukkit.command.Command command, String[] args) static voidloadAddons(org.bukkit.plugin.java.JavaPlugin plugin, Object teconfig, Addon... defaultaddons) protected voidloadConfig(org.bukkit.configuration.file.FileConfiguration config) If the addmon module needs to load any configuration informaiton from config.yml, config loading process should be written in this method.booleanonCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) if your custom enchantment provides any special command, you can write your command process here.voidvoidonEnable()onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) if your custom enchantment provides any special command, you can write your tab completion process here.static voidregisterAddon(Addon aoh) static voidregisterAddonClass(Class<?> klass, String id) voidRegister event name and process priority pair.protected StringThis method returns the version string of the required TokenEnchant plugin.Register event name and process priority pair.protected boolean
-
Field Details
-
DEFAULT_KEY
- See Also:
-
KEY
-
plugin
protected final org.bukkit.plugin.Plugin plugin -
config
protected org.bukkit.configuration.file.FileConfiguration config -
subCommand
-
eventPriorityMap
-
-
Constructor Details
-
Addon
protected Addon(org.bukkit.plugin.Plugin plugin, Object teconfig) throws InvalidTokenEnchantException - Throws:
InvalidTokenEnchantException
-
-
Method Details
-
getAddonWithID
-
getAddons
-
enableAddons
public static void enableAddons() -
disableAddons
public static void disableAddons() -
loadAddons
-
registerAddonClass
-
registerAddon
-
getID
-
shouldRegister
protected boolean shouldRegister() -
getID
-
getVersion
Returns the version of this custom enchantment- Returns:
- the version of this custom enchantment
-
requiredTokenEnchantVersion
This method returns the version string of the required TokenEnchant plugin.- Returns:
- the version string of the required TokenEnchant plugin. ('*' represents any version)
-
getName
Returns the simplified class name.- Returns:
- the simplified class name.
-
onEnable
public void onEnable() -
onDisable
public void onDisable() -
reloadConfig
public void reloadConfig() -
getConfig
protected org.bukkit.configuration.file.FileConfiguration getConfig() -
loadConfig
protected void loadConfig(org.bukkit.configuration.file.FileConfiguration config) If the addmon module needs to load any configuration informaiton from config.yml, config loading process should be written in this method.
This method will automatically be called when TokenEnchant plugin is loaded. -
isAllowed
A utility method to return whether the specified player has the specified permission or not.- Parameters:
p- a plaer to be checked.perm- a permission node to be checked.- Returns:
- true if the player has the permission, false otherwise
-
getAllowed
A utility method to return a chat color based on whether the specified player has the specified permission or not.- Parameters:
p- a plaer to be checked.perm- a permission node to be checked.- Returns:
- ChatColor.AQUA if the player has the permission, ChatColor.GRAY otherwise.
-
isMyCommand
-
getSubCommandString
-
onCommand
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) if your custom enchantment provides any special command, you can write your command process here. The command will be "/te yourcommand arguments..." -
onTabComplete
public List<String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) if your custom enchantment provides any special command, you can write your tab completion process here. The command will be "/te yourcommand arguments..." -
doHelp
public void doHelp(org.bukkit.command.CommandSender sender) If this custom enchantment/potion has a command, you can provide its help description in this method. This method will automatically be called from TokenEnchant and the help will be included in TokenEnchant's /te help menu.if (isAllowed(sender, "myenchant.mycommand")) sender.sendMessage("- " + getAllowed(sender, "myenchant.mycommandd") + "/tokenenchant mycommand arguments : mycommand does xxxxx.");- Parameters:
sender- CommandSender object which issued the /te help command
-
getEventPriorityMap
This method returns the pair of evnet name and its process priority for this CE.- Specified by:
getEventPriorityMapin interfacecom.vk2gpz.mc.event.EventMapper- Returns:
- the pair of evnet name and its process priority for this CE.
-
set
public Map<String,org.bukkit.event.EventPriority> set(String eventName, org.bukkit.event.EventPriority priority) Register event name and process priority pair.- Specified by:
setin interfacecom.vk2gpz.mc.event.EventMapper- Parameters:
eventName- the name of the event class (e.g. BlockBreakEvent.class.getSimpleName())- Returns:
- the pair of evnet name and its process priority for this CE.
-
remove
Register event name and process priority pair.- Specified by:
removein interfacecom.vk2gpz.mc.event.EventMapper- Parameters:
eventName- the name of the event class (e.g. BlockBreakEvent.class.getSimpleName())- Returns:
- the pair of evnet name and its process priority for this CE.
-