/* Copyright 2016 Acquized
 *
 * 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.github.acquized.nametags;


import com.github.acquized.nametags.config.Config;
import com.github.acquized.nametags.utils.Metrics;

import net.cubespace.Yamler.Config.InvalidConfigurationException;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

import lombok.Getter;

import static org.bukkit.ChatColor.GRAY;
import static org.bukkit.ChatColor.GREEN;

public class Nametags extends JavaPlugin {

    public static String prefix = GREEN + "> " + GRAY;
    @Getter private static Nametags instance;
    @Getter private Logger log = LoggerFactory.getLogger(Nametags.class);
    @Getter private Config config;

    @Override
    public void onEnable() {
        instance = this;
        if(!areDependenciesInstalled()) {
            log.error("Could not load ProtocolLib or Vault. Please install both plugins and restart the server.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        loadConfigs();
        prefix = ChatColor.translateAlternateColorCodes('&', config.prefix);
        // packet setup (protocollib)
        // vault hooking
        // api setup
        registerListeners(Bukkit.getPluginManager());
        registerCommands();
        log.info("Nametags v{} has been enabled.", getDescription().getVersion());
        try {
            Metrics metrics = new Metrics(this);
            addCustomGraphs(metrics);
        } catch (Exception ex) {
            log.warn("Could not submit data to bStats.org", ex);
        }
        if(config.updater)
            // start updating
        return;
    }

    @Override
    public void onDisable() {
        instance = null;
        log.info("Nametags v{} has been disabled.", getDescription().getVersion());
    }

    @SuppressWarnings("ResultOfMethodCallIgnored")
    private void loadConfigs() {
        // config.yml
        try {
            File file = new File(getDataFolder(), "config.yml");
            config = new Config(file);
            config.init();
            if (!config.version.equalsIgnoreCase(getDescription().getVersion())) {
                file.delete();
                config.init();
            }
        } catch (InvalidConfigurationException ex) {
            log.error("Could not load config.yml file - Please check for errors", ex);
        }

    }

    private boolean areDependenciesInstalled() {
        return (Bukkit.getPluginManager().isPluginEnabled("ProtocolLib")) && (Bukkit.getPluginManager().isPluginEnabled("Vault"));
    }

    private void registerListeners(PluginManager pm) {

    }

    private void registerCommands() {

    }

    private void addCustomGraphs(Metrics metrics) {

    }

}

@@ -1366,20 +1366,18 @@
 fig conf
-ig
 ;%0A
+
 %0A    @Ov
@@ -1771,18 +1771,16 @@
 &', conf
-ig
 .prefix)
@@ -2254,18 +2254,16 @@
  if(conf
-ig
 .updater
@@ -2678,18 +2678,16 @@
     conf
-ig
  = new C
@@ -2707,34 +2707,32 @@
             conf
-ig
 .init();%0A       
@@ -2745,18 +2745,16 @@
 f (!conf
-ig
 .version
@@ -2832,24 +2832,24 @@
 e.delete();%0A
+
             
@@ -2856,18 +2856,16 @@
     conf
-ig
 .init();

Rename config variable to fix a few JavaPlugin errors