/*
 * Copyright 2014 Gabriel Harris-Rouquette
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http:www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.afterkraft.kraftrpg;

import java.util.logging.Level;

import org.bukkit.plugin.java.JavaPlugin;

import com.afterkraft.kraftrpg.api.RPGPlugin;
import com.afterkraft.kraftrpg.api.entity.effects.EffectManager;
import com.afterkraft.kraftrpg.api.entity.party.PartyManager;
import com.afterkraft.kraftrpg.api.handler.CraftBukkitHandler;
import com.afterkraft.kraftrpg.api.listeners.ListenerManager;
import com.afterkraft.kraftrpg.entity.RPGEntityManager;
import com.afterkraft.kraftrpg.entity.effects.RPGEffectManager;
import com.afterkraft.kraftrpg.entity.party.RPGPartyManager;
import com.afterkraft.kraftrpg.entity.roles.RPGRoleManager;
import com.afterkraft.kraftrpg.listeners.RPGListenerManager;
import com.afterkraft.kraftrpg.skills.RPGSkillConfigManager;
import com.afterkraft.kraftrpg.skills.RPGSkillManager;
import com.afterkraft.kraftrpg.storage.RPGStorageManager;
import com.afterkraft.kraftrpg.util.RPGConfigManager;
import com.afterkraft.kraftrpg.util.RPGDamageManager;
import com.afterkraft.kraftrpg.util.RPGPluginProperties;


public final class KraftRPGPlugin extends JavaPlugin implements RPGPlugin {

    private static KraftRPGPlugin instance;

    private RPGSkillManager skillManager;
    private RPGSkillConfigManager skillConfigManager;
    private RPGEntityManager entityManager;
    private RPGStorageManager storageManager;
    private RPGPluginProperties properties;
    private RPGDamageManager damageManager;
    private RPGConfigManager configManager;
    private RPGRoleManager roleManager;
    private RPGPartyManager partyManager;
    private RPGEffectManager effectManager;
    private RPGListenerManager listenerManager;

    public static KraftRPGPlugin getInstance() {
        return KraftRPGPlugin.instance;
    }

    @Override
    public void onEnable() {
        instance = this;
        CraftBukkitHandler.getInterface(); // Initialize CraftBukkitHandler so nothing else has to
        this.properties = new RPGPluginProperties();
        this.configManager = new RPGConfigManager(this);
        this.storageManager = new RPGStorageManager(this);
        this.damageManager = new RPGDamageManager(this);
        this.roleManager = new RPGRoleManager(this);
        this.entityManager = new RPGEntityManager(this);
        this.skillManager = new RPGSkillManager(this);
        this.skillConfigManager = new RPGSkillConfigManager(this);
        this.effectManager = new RPGEffectManager(this);
        this.partyManager = new RPGPartyManager(this);
        this.listenerManager = new RPGListenerManager(this);
        CraftBukkitHandler.getInterface().loadExtraListeners();

    }

    @Override
    public RPGSkillConfigManager getSkillConfigManager() {
        return this.skillConfigManager;
    }

    @Override
    public RPGEntityManager getEntityManager() {
        return this.entityManager;
    }

    @Override
    public EffectManager getEffectManager() {
        return this.effectManager;
    }

    @Override
    public RPGStorageManager getStorageManager() {
        return this.storageManager;
    }

    @Override
    public RPGConfigManager getConfigurationManager() {
        return this.configManager;
    }

    @Override
    public RPGDamageManager getDamageManager() {
        return this.damageManager;
    }

    @Override
    public RPGSkillManager getSkillManager() {
        return this.skillManager;
    }

    @Override
    public RPGRoleManager getRoleManager() {
        return this.roleManager;
    }

    @Override
    public PartyManager getPartyManager() {
        return this.partyManager;
    }

    public RPGPluginProperties getProperties() {
        return this.properties;
    }

    @Override
    public ListenerManager getListenerManager() {
        return this.listenerManager;
    }

    @Override
    public void log(Level level, String msg) {

    }

    @Override
    public void debugLog(Level level, String msg) {

    }

    @Override
    public void debugThrow(String sourceClass, String sourceMethod, Throwable thrown) {

    }
}

@@ -710,16 +710,81 @@
 lugin;%0A%0A
+import com.afterkraft.kraftrpg.api.ExternalProviderRegistration;%0A
 import c
@@ -821,16 +821,16 @@
 Plugin;%0A
-
 import c
@@ -1836,16 +1836,59 @@
 nstance;
+%0A    private static boolean cancel = false;
 %0A%0A    pr
@@ -2462,32 +2462,203 @@
 nstance;%0A    %7D%0A%0A
+    @Override%0A    public void onLoad() %7B%0A        // Register our defaults%0A        // TODO%0A        ExternalProviderRegistration.registerStorageBackend(null, %22yml%22);%0A    %7D%0A%0A
     @Override%0A  
@@ -2808,16 +2808,64 @@
  has to%0A
+        ExternalProviderRegistration.finish();%0A%0A
         
@@ -3017,32 +3017,60 @@
 eManager(this);%0A
+        if (cancel) return;%0A
         this.dam
@@ -3575,24 +3575,160 @@
 isteners();%0A
+    %7D%0A%0A    @Override%0A    public void cancelEnable() %7B%0A        cancel = true;%0A        getServer().getPluginManager().disablePlugin(this);
 %0A    %7D%0A%0A    

Add ExternalProviderRegistration calls to plugin