2016-06-18 17:16:32 +02:00
|
|
|
package me.libraryaddict.disguise.commands;
|
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import me.libraryaddict.disguise.DisguiseAPI;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Navid
|
|
|
|
*/
|
2016-11-28 22:47:48 +01:00
|
|
|
public class DisguiseViewSelfCommand implements CommandExecutor {
|
2016-06-18 17:16:32 +02:00
|
|
|
|
|
|
|
@Override
|
2016-11-28 15:01:06 +01:00
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
if (sender.getName().equals("CONSOLE")) {
|
2016-06-18 17:16:32 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
|
|
|
|
return true;
|
|
|
|
}
|
2016-11-28 15:01:06 +01:00
|
|
|
|
2016-06-18 17:16:32 +02:00
|
|
|
Player player = (Player) sender;
|
2016-11-28 15:01:06 +01:00
|
|
|
|
|
|
|
if (DisguiseAPI.isViewSelfToggled(player)) {
|
2016-06-18 17:16:32 +02:00
|
|
|
DisguiseAPI.setViewDisguiseToggled(player, false);
|
|
|
|
sender.sendMessage(ChatColor.GREEN + "Toggled viewing own disguise off!");
|
|
|
|
}
|
2016-11-28 15:01:06 +01:00
|
|
|
else {
|
2016-06-18 17:16:32 +02:00
|
|
|
DisguiseAPI.setViewDisguiseToggled(player, true);
|
|
|
|
sender.sendMessage(ChatColor.GREEN + "Toggled viewing own disguise on!");
|
|
|
|
}
|
2016-11-28 15:01:06 +01:00
|
|
|
|
2016-06-18 17:16:32 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|