@Override
	public void onEnable(){
		plugin = this;
		plugin.getConfig().options().copyDefaults(true);
		saveConfig();
		plugin.reloadConfig();
		
		hostname = "http://api.minetrends.com";
		//hostname = "http://192.168.1.33";
		
		refreshConfig();
		
		//Check if a new update is available.
		if (plugin.getConfig().getBoolean("check-updates")){
			Bukkit.getLogger().info("<Minetrends> Checking for updates...");
			Updater updater = new Updater(plugin, 76929, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
			update = updater.getResult();
			if (update == Updater.UpdateResult.UPDATE_AVAILABLE) {
				name = updater.getLatestName(); // Get the latest version
				version = updater.getLatestName().substring(updater.getLatestName().lastIndexOf('v') + 1);
				Bukkit.getLogger().info("***************************************************************");
				Bukkit.getLogger().info("There is a new Minetrends update available for download! (v" + version + ")");
				Bukkit.getLogger().info("Type /minetrends update to download the update.");
				Bukkit.getLogger().info("***************************************************************");
			} else if (updater.getResult() == Updater.UpdateResult.NO_UPDATE){
				//Up to date! Yay!
			}
		} else {
			Bukkit.getLogger().info("You have disabled update checking in the Minetrends configuration file!");
		}
		
		publicKey = Encryption.getServerKey();
		privateKey = Encryption.getPrivateKey();
		
		//If any players are currently online, add them to the playerJoins HashMap.
		for (Player player : Bukkit.getServer().getOnlinePlayers()) {
			if (!(Minetrends.playerJoins.containsKey(player.getName()))){
				Minetrends.playerJoins.put(player.getName(), System.currentTimeMillis());
			}
		}
		
		//Start TPS monitor.
		Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new TPSChecker(), 100L, 1L);
		
		//Register Event Listeners
		Bukkit.getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
		
		Bukkit.getLogger().info(getDescription().getName() + " v" + getDescription().getVersion() + " has been enabled!");
	}