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
    Modifier and Type
    Field
    Description
    protected org.bukkit.configuration.file.FileConfiguration
     
    protected static final String
     
    protected Map<String,org.bukkit.event.EventPriority>
     
    protected String
     
    protected final org.bukkit.plugin.Plugin
     
    protected String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Addon(org.bukkit.plugin.Plugin plugin, Object teconfig)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    void
    doHelp(org.bukkit.command.CommandSender sender)
    If this custom enchantment/potion has a command, you can provide its help description in this method.
    static void
     
     
    static Addon
     
    protected org.bukkit.ChatColor
    getAllowed(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.FileConfiguration
     
    Map<String,org.bukkit.event.EventPriority>
    This method returns the pair of evnet name and its process priority for this CE.
    protected String
     
    static String
    getID(Class<?> klass)
     
    protected String
    Returns the simplified class name.
    protected String
     
    protected String
    Returns the version of this custom enchantment
    protected static boolean
    isAllowed(org.bukkit.permissions.Permissible p, String perm)
    A utility method to return whether the specified player has the specified permission or not.
    protected boolean
    isMyCommand(org.bukkit.command.Command command, String[] args)
     
    static void
    loadAddons(org.bukkit.plugin.java.JavaPlugin plugin, Object teconfig, Addon... defaultaddons)
     
    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.
    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.
    void
     
    void
     
    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 void
     
    static void
     
    void
     
    Map<String,org.bukkit.event.EventPriority>
    remove(String eventName)
    Register event name and process priority pair.
    protected String
    This method returns the version string of the required TokenEnchant plugin.
    Map<String,org.bukkit.event.EventPriority>
    set(String eventName, org.bukkit.event.EventPriority priority)
    Register event name and process priority pair.
    protected boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_KEY

      protected static final String DEFAULT_KEY
      See Also:
    • KEY

      protected String KEY
    • plugin

      protected final org.bukkit.plugin.Plugin plugin
    • config

      protected org.bukkit.configuration.file.FileConfiguration config
    • subCommand

      protected String subCommand
    • eventPriorityMap

      protected Map<String,org.bukkit.event.EventPriority> eventPriorityMap
  • Constructor Details

  • Method Details

    • getAddonWithID

      public static Addon getAddonWithID(String id)
    • getAddons

      public static Collection<Addon> getAddons()
    • enableAddons

      public static void enableAddons()
    • disableAddons

      public static void disableAddons()
    • loadAddons

      public static void loadAddons(org.bukkit.plugin.java.JavaPlugin plugin, Object teconfig, Addon... defaultaddons)
    • registerAddonClass

      public static void registerAddonClass(Class<?> klass, String id)
    • registerAddon

      public static void registerAddon(Addon aoh)
    • getID

      public static String getID(Class<?> klass)
    • shouldRegister

      protected boolean shouldRegister()
    • getID

      protected String getID()
    • getVersion

      protected String getVersion()
      Returns the version of this custom enchantment
      Returns:
      the version of this custom enchantment
    • requiredTokenEnchantVersion

      protected String 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

      protected String 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

      protected static boolean isAllowed(org.bukkit.permissions.Permissible p, String perm)
      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

      protected org.bukkit.ChatColor getAllowed(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.
      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

      protected boolean isMyCommand(org.bukkit.command.Command command, String[] args)
    • getSubCommandString

      protected String 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

      public Map<String,org.bukkit.event.EventPriority> getEventPriorityMap()
      This method returns the pair of evnet name and its process priority for this CE.
      Specified by:
      getEventPriorityMap in interface com.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:
      set in interface com.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

      public Map<String,org.bukkit.event.EventPriority> remove(String eventName)
      Register event name and process priority pair.
      Specified by:
      remove in interface com.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.