Newer
Older
/**
* @author Spotlight
* @date Saturday, December 12th, 2015
* @version 0.1.1
* @category Spigot
* @category Plugins
* @license MIT
*/
package io.github.packserver.RegPlug;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
/**
* Global debug mode
*/
static Boolean DEBUG;
/**
* Plugin instance
*/
static Main plugin;
/**
* Fired when plugin is first enabled
*/
// Create plugin instance and hand it to plugin
plugin = this;
// Try to run websocket server
try {
WebsocketServer.runServer();
} catch (InterruptedException | IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
// Debug mode
// Find if we are in debug mode or not
InputStream in = getClass().getResourceAsStream("/config.yml");
FileConfiguration config = YamlConfiguration.loadConfiguration(in);
DEBUG = config.getBoolean("debug");
}
/**
* Fired when plugin is disabled
*/
@Override
public void onDisable() {
try {
WebsocketServer.server.stop();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}