Added the new /disguiseviewself command, allows for toggling the disguise model when you see yourself.

Permission is libsdisguises.viewself
Aliases are: [dviewself, dvs, disguisevs, disvs, vsd, viewselfdisguise, viewselfd]
This commit is contained in:
NavidK0
2015-07-15 05:51:38 -04:00
parent 1d54ba9997
commit b57e9931b0
8 changed files with 124 additions and 6 deletions

View File

@@ -0,0 +1,37 @@
package me.libraryaddict.disguise.commands;
import me.libraryaddict.disguise.DisguiseAPI;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*
* @author Navid
*/
public class DisguiseViewSelf implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) {
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
return true;
}
if (sender.hasPermission("libsdisguises.viewself")) {
Player player = (Player) sender;
if (DisguiseAPI.isViewSelfToggled(player)) {
DisguiseAPI.setViewDisguiseToggled(player, false);
sender.sendMessage(ChatColor.GREEN + "Toggled viewing own disguise off!");
} else {
DisguiseAPI.setViewDisguiseToggled(player, true);
sender.sendMessage(ChatColor.GREEN + "Toggled viewing own disguise on!");
}
} else {
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
}
return true;
}
}