2013-09-25 16:49:24 +02:00
|
|
|
package me.libraryaddict.disguise.commands;
|
|
|
|
|
2013-05-29 00:44:55 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseAPI;
|
2013-05-21 04:23:58 +02:00
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
2013-07-21 05:17:21 +02:00
|
|
|
import org.bukkit.entity.Entity;
|
2013-05-21 04:23:58 +02:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
public class UndisguiseCommand implements CommandExecutor {
|
|
|
|
|
2013-05-29 00:52:54 +02:00
|
|
|
@Override
|
2013-05-21 04:23:58 +02:00
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
2013-07-16 07:01:32 +02:00
|
|
|
if (sender.getName().equals("CONSOLE")) {
|
|
|
|
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-21 04:23:58 +02:00
|
|
|
if (sender.hasPermission("libsdisguises.undisguise")) {
|
2013-07-21 05:17:21 +02:00
|
|
|
if (DisguiseAPI.isDisguised((Entity) sender)) {
|
2013-07-16 07:01:32 +02:00
|
|
|
DisguiseAPI.undisguiseToAll((Player) sender);
|
2013-05-21 04:23:58 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "You are no longer disguised");
|
2015-08-03 00:39:44 +02:00
|
|
|
} else {
|
2013-05-21 04:23:58 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "You are not disguised!");
|
2015-08-03 00:39:44 +02:00
|
|
|
}
|
|
|
|
} else {
|
2014-06-01 17:52:54 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
2015-08-03 00:39:44 +02:00
|
|
|
}
|
2013-05-21 04:23:58 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|