package me.denagon.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import me.denagon.denagoninfo.Main;
import mkremins.fanciful.FancyMessage;

public class CmdStore implements CommandExecutor {

	private final Main plugin;
	public CmdStore(Main instance)
	{
		plugin = instance;
	}
	
	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
		Boolean Store0 = plugin.getConfig().getBoolean("store.enabled");
		String Store1 = plugin.getConfig().getString("store.prefix");
		String Store2 = plugin.getConfig().getString("store.text");
		String Store3 = plugin.getConfig().getString("store.link");
		String Store4 = plugin.getConfig().getString("store.tooltip");
		if (cmd.getName().equalsIgnoreCase("store") && Store0)
		{
			new FancyMessage(color(Store1))
			.color(ChatColor.GOLD)
			.then(color(Store2))
			.style(ChatColor.UNDERLINE)
			.color(ChatColor.BLUE)
			.link(Store3)
			.tooltip(color(Store4))
			.send(sender);
			return true;
		}
		return false;
	}
	
	public String color(String str) {
		return ChatColor.translateAlternateColorCodes('&', str);
	}

}
