package com.publicuhc.ultrahardcore;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import org.bukkit.Bukkit;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.publicuhc.ultrahardcore.features.deathbans.DeathBan;
import org.mcstats.Metrics;

/**
 * UltraHardcore
 * <p/>
 * Main plugin class, init
 *
 * @author ghowden
 */
@Singleton
public class UltraHardcore extends JavaPlugin implements Listener {

    /**
     * @return the current instance of the plugin
     */
    public static Plugin getInstance() {
        return Bukkit.getPluginManager().getPlugin("UltraHardcore");
    }

    //When the plugin gets started
    @Override
    public void onEnable() {
        //register deathbans for serilization
        ConfigurationSerialization.registerClass(DeathBan.class);
        //register the bungeecord plugin channel
        getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");

        Injector injector = Guice.createInjector(new UHCModule(this));

        DefaultClasses defaults = injector.getInstance(DefaultClasses.class);

        //load all the configs
        defaults.loadDefaultConfigurations();
        //load all the features
        defaults.loadDefaultFeatures(injector);
        //load all the scatter types
        defaults.loadDefaultScatterTypes(injector);
        //load all the commands
        defaults.loadDefaultCommands();

        if(Bukkit.getPluginManager().getPlugin("WorldEdit") != null){
            //load the default border types
            defaults.loadDefaultBorders();
        }

        Metrics metrics = injector.getInstance(Metrics.class);
        metrics.start();

    }
}
@@ -46,46 +46,165 @@
 com.
-google.inject.Guice;%0Aimport com.google
+publicuhc.pluginframework.FrameworkJavaPlugin;%0Aimport com.publicuhc.pluginframework.shaded.inject.AbstractModule;%0Aimport com.publicuhc.pluginframework.shaded
 .inj
@@ -213,18 +213,16 @@
 t.Inject
-or
 ;%0Aimport
@@ -230,332 +230,333 @@
 com.
-google.inject.Singleton;%0Aimport org.bukkit.Bukkit;%0Aimport org.bukkit.configuration.serialization.ConfigurationSerialization;%0Aimport org.bukkit.event.Listener;%0Aimport org.bukkit.plugin.Plugin;%0Aimport org.bukkit.plugin.java.JavaPlugin;%0Aimport com.publicuhc.ultrahardcore.features.deathbans.DeathBan;%0Aimport org.mcstats.Metrics
+publicuhc.pluginframework.shaded.inject.Singleton;%0Aimport com.publicuhc.ultrahardcore.features.deathbans.DeathBan;%0Aimport org.bukkit.Bukkit;%0Aimport org.bukkit.configuration.serialization.ConfigurationSerialization;%0Aimport org.mcstats.Metrics;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.logging.Level
 ;%0A%0A/
@@ -682,16 +682,25 @@
 extends 
+Framework
 JavaPlug
@@ -706,212 +706,62 @@
 gin 
-implements Listener %7B%0A%0A    /**%0A     * @return the current instance of the plugin%0A     */%0A    public static Plugin getInstance() %7B%0A        return Bukkit.getPluginManager().getPlugin(%22UltraHardcore%22);%0A    %7D
+%7B%0A%0A    private DefaultClasses m_defaultClasses = null;
 %0A%0A  
@@ -1096,162 +1096,147 @@
     
-Injector injector = Guice.createInjector(new UHCModule(this));%0A%0A        DefaultClasses defaults = injector.getInstance(DefaultClasses.class);%0A
+if(Bukkit.getPluginManager().getPlugin(%22WorldEdit%22) == null)%7B%0A            m_defaultClasses.loadBorders();%0A        %7D
 %0A    
+%7D%0A%0A
     /
-/l
+**%0A     * L
 oad 
@@ -1247,262 +1247,247 @@
 the 
-configs%0A        defaults.loadDefaultConfigurations();%0A        //load all the features%0A        defaults.loadDefaultFeatures(injector);%0A        //load all the scatter types%0A        defaults.loadDefaultScatterTypes(injector);%0A        //load all the commands
+defaults for the entire plugin, DefaultClasses will do this when being created so we just print that it is done%0A     * @param defaultClasses init class%0A     */%0A    @Inject%0A    public void loadDefaultClasses(DefaultClasses defaultClasses) %7B
 %0A   
@@ -1495,269 +1495,492 @@
     
+m_
 default
-s.loadDefaultCommands();%0A%0A        if(Bukkit.getPluginManager().getPlugin(%22WorldEdit%22) != null)%7B
+Classes = defaultClasses;%0A        getLogger().log(Level.INFO, %22All default classes loaded%22);
 %0A    
+%7D%0A%0A
     
-    //load the default border types
+/**%0A     * Load the metrics class and start it%0A     * @param metrics the metrics to use
 %0A     
+*/%0A
     
-   defaults.loadDefaultBorders();%0A        %7D%0A%0A        Metrics metrics = injector.getInstance(Metrics.class
+@Inject%0A    public void loadMetrics(Metrics metrics) %7B%0A        metrics.start();%0A    %7D%0A%0A    @Override%0A    public List%3CAbstractModule%3E initialModules() %7B%0A        List%3CAbstractModule%3E customModules = new ArrayList%3CAbstractModule%3E();%0A        customModules.add(new UHCModule()
 );%0A 
@@ -1986,33 +1986,37 @@
         
-metrics.start();%0A
+return customModules;
 %0A    %7D%0A%7D

make startup use new framework system