package kernitus.plugin.OldCombatMechanics.module;

import kernitus.plugin.OldCombatMechanics.OCMMain;
import kernitus.plugin.OldCombatMechanics.utilities.ArrayUtils;
import kernitus.plugin.OldCombatMechanics.utilities.Config;
import kernitus.plugin.OldCombatMechanics.utilities.Messenger;
import org.apache.commons.lang.WordUtils;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.Listener;

/**
 * Created by Rayzr522 on 6/25/16.
 */
public class Module implements Listener {

    protected OCMMain plugin;
    protected String configName;

    private String moduleName;

    public Module(OCMMain plugin, String configName){
        this.plugin = plugin;
        this.configName = configName;
        moduleName = ArrayUtils.last(getClass().getSimpleName().split("\\."));
    }

    public boolean isEnabled(World world){
        return Config.moduleEnabled(configName, world);
    }

    public boolean isEnabled(){
        return isEnabled(null);
    }

    public boolean isSettingEnabled(String name){
        return plugin.getConfig().getBoolean(configName + "." + name);
    }

    public ConfigurationSection module(){
        return plugin.getConfig().getConfigurationSection(configName);
    }

    public void reload(){
        // Intentionally left blank! Meant for individual modules to use.
    }

    protected void debug(String text){
        Messenger.debug("[" + moduleName + "] " + text);
    }

    protected void debug(String text, CommandSender sender){
        if(Config.debugEnabled()){
            Messenger.send(sender, "&8&l[&fDEBUG&8&l][&f" + moduleName + "&8&l]&7 " + text);
        }
    }

    @Override
    public String toString(){
        return WordUtils.capitalizeFully(configName.replaceAll("-", " "));
    }
}

@@ -491,38 +491,92 @@
 %0A * 
-Created by Rayzr522 on 6/25/16
+A module providing some specific functionality, e.g. restoring fishing rod knockback
 .%0A *
@@ -584,16 +584,25 @@
 %0Apublic 
+abstract 
 class Mo
@@ -659,29 +659,28 @@
 plugin;%0A
+%0A
     pr
-otec
+iva
 te
-d
  String 
@@ -687,25 +687,24 @@
 configName;%0A
-%0A
     private 
@@ -727,22 +727,184 @@
 e;%0A%0A    
-public
+/**%0A     * Creates a new module.%0A     *%0A     * @param plugin     the plugin instance%0A     * @param configName the name of the module in the config%0A     */%0A    protected
  Module(
@@ -1101,180 +1101,787 @@
     
-public boolean isEnabled(World world)%7B%0A        return Config.moduleEnabled(configName, world);%0A    %7D%0A%0A    public boolean isEnabled()%7B%0A        return isEnabled(null);%0A    %7D%0A
+/**%0A     * Checks whether the plugin is enabled in the given world.%0A     *%0A     * @param world the world to check. Null to check whether it is globally disabled%0A     * @return true if the plugin is enabled in that world%0A     */%0A    public boolean isEnabled(World world)%7B%0A        return Config.moduleEnabled(configName, world);%0A    %7D%0A%0A    /**%0A     * Checks whether this plugin is globally en/disabled.%0A     *%0A     * @return true if this plugin is globally enabled%0A     */%0A    public boolean isEnabled()%7B%0A        return isEnabled(null);%0A    %7D%0A%0A    /**%0A     * Checks whether a given setting for this plugin is enabled.%0A     *%0A     * @param name the name of the setting%0A     * @return true if the setting with that name is enabled. Returns false if the setting did not exist.%0A     */
 %0A   
@@ -1995,16 +1995,23 @@
 %22 + name
+, false
 );%0A    %7D
@@ -2020,123 +2020,412 @@
     
-public ConfigurationSection module()%7B%0A        return plugin.getConfig().getConfigurationSection(configName);%0A    %7D%0A
+/**%0A     * Returns the configuration section for this module.%0A     *%0A     * @return the configuration section for this module%0A     */%0A    public ConfigurationSection module()%7B%0A        return plugin.getConfig().getConfigurationSection(configName);%0A    %7D%0A%0A    /**%0A     * Called when the plugin is reloaded. Should re-read all relevant config keys and other resources that might have%0A     * changed.%0A     */
 %0A   
@@ -2520,32 +2520,123 @@
  to use.%0A    %7D%0A%0A
+    /**%0A     * Outputs a debug message.%0A     *%0A     * @param text the message text%0A     */%0A
     protected vo
@@ -2718,24 +2718,189 @@
 xt);%0A    %7D%0A%0A
+    /**%0A     * Sends a debug message to the given command sender.%0A     *%0A     * @param text   the message text%0A     * @param sender the sender to send it to%0A     */%0A
     protecte

Add some javadoc, make module abstract