@Override
	public void onEnable() {
		instance = this;
		getDataFolder().mkdirs();
		
		final File configFile = new File(getDataFolder(), "config.yml");
		final InputStream dcStream = getClass().getResourceAsStream("/defaultconfig.yml");
		
		try {
			if (!configFile.exists()) {
				IOUtil.copy(dcStream, configFile);
			}
			
			config = YamlConfiguration.loadConfiguration(configFile);
		} catch (IOException e) {
			Logger.severe("Failed to copy default config! Using default values.");
			config = YamlConfiguration.loadConfiguration(dcStream);
		} finally {
			try {
				dcStream.close();
			} catch (Exception e) {}
		}
		
		final File layoutFile = new File(getDataFolder(), "layout.xml");
		if (!layoutFile.exists()) {
			BoardLayout.copyDefaultLayoutFile();
		}
		
		BoardLayout layout;
		
		try {
			layout = BoardLayout.loadFromXml(new FileInputStream(layoutFile), config.getString("layout"));
		} catch (FileNotFoundException e) {
			//Failed to find file. Load default layout
			layout = BoardLayout.loadFromXml(getClass().getResourceAsStream("/layout.xml"), "default");
		}
		
		scoreboard = new StaffScoreboard(layout);
		
		int autoAfk = config.getInt("auto-afk", 600);
		if (autoAfk >= 0) {
			afkDetector = new AFKDetector(this, autoAfk);
			afkDetector.startDetector();
		}
		
		vanishHook = new VanishHook();
		
		CommandHandler.initCommands();
		
		getCommand("staff").setExecutor(new CommandHandler());
		
		getServer().getPluginManager().registerEvents(this, this);
		
		Logger.info("StaffInformer v" + getDescription().getVersion() + " enabled!");
	}