package daanielz.tools.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import daanielz.tools.Utils;


public class WorkbenchCmd implements CommandExecutor {
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(sender instanceof Player){
      Player p = (Player) sender;
      if(cmd.getName().equalsIgnoreCase("workbench")){
    	  if(!sender.hasPermission("vetesda.workbench")){
    		  sender.sendMessage(Utils.getColor("&8» &7Nie masz uprawnien."));
    	  } else{
    	        p.openWorkbench(null, true);
    	  }
      } else if(cmd.getName().equalsIgnoreCase("enchanttable")){
    	  if(!sender.hasPermission("vetesda.enchanttable")){
    		  sender.sendMessage(Utils.getColor("&8» &7Nie masz uprawnien."));
    	  } else{
    	        p.openEnchanting(null, true);
    	  }
      }
    } return true;
  }
}