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;

import java.io.IOException;

/**
 * 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();
        }

        //Load all the metric infos
        try {
            Metrics met = new Metrics(this);
            met.start();
        } catch (IOException ignored) {
        }
    }
}
@@ -440,37 +440,8 @@
 s;%0A%0A
-import java.io.IOException;%0A%0A
 /**%0A
@@ -1651,24 +1651,28 @@
 l)%7B%0A        
+    
 //load the d
@@ -1683,32 +1683,36 @@
 lt border types%0A
+    
         defaults
@@ -1757,91 +1757,59 @@
     
-//Load all the metric infos%0A        try %7B%0A            Metrics met = new 
+Metrics metrics = injector.getInstance(
 Metrics
-(thi
+.clas
 s);%0A
@@ -1820,15 +1820,15 @@
     
-   
- 
 met
+rics
 .sta
@@ -1837,57 +1837,8 @@
 ();%0A
-        %7D catch (IOException ignored) %7B%0A        %7D
 %0A   

use injector for metrics