Add dlist and fix dradius error
This commit is contained in:
		@@ -112,6 +112,7 @@ public class LibsDisguises extends JavaPlugin
 | 
			
		||||
        getCommand("disguiseclone").setExecutor(new CloneDisguiseCommand());
 | 
			
		||||
        getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand());
 | 
			
		||||
        getCommand("disguiseviewself").setExecutor(new DisguiseViewSelf());
 | 
			
		||||
        getCommand("disguiselist").setExecutor(new DisguiseListCommand());
 | 
			
		||||
 | 
			
		||||
        registerValues();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,68 @@
 | 
			
		||||
package me.libraryaddict.disguise.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
 | 
			
		||||
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
 | 
			
		||||
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
 | 
			
		||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.command.Command;
 | 
			
		||||
import org.bukkit.command.CommandExecutor;
 | 
			
		||||
import org.bukkit.command.CommandSender;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
public class DisguiseListCommand implements CommandExecutor
 | 
			
		||||
{
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		if (sender.hasPermission("libsdisguises.seecmd.disguiselist"))
 | 
			
		||||
		{
 | 
			
		||||
			String players = "";
 | 
			
		||||
			int numPlayers = 0;
 | 
			
		||||
			int numOther = 0;
 | 
			
		||||
			
 | 
			
		||||
			// Go through all disguises
 | 
			
		||||
			for (UUID uuid: DisguiseUtilities.getDisguises().keySet())
 | 
			
		||||
			{
 | 
			
		||||
				Player player = Bukkit.getPlayer(uuid);
 | 
			
		||||
				TargetedDisguise disguise = DisguiseUtilities.getMainDisguise(uuid);
 | 
			
		||||
 | 
			
		||||
				if (player == null || !player.isOnline())
 | 
			
		||||
				{
 | 
			
		||||
					// Assume this is a non-player entity
 | 
			
		||||
					numOther++;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					// This is a player
 | 
			
		||||
					numPlayers++;
 | 
			
		||||
					players += " " + ChatColor.AQUA + player.getName() + ChatColor.GRAY + "("
 | 
			
		||||
							+ disguise.getType().toReadable();
 | 
			
		||||
					
 | 
			
		||||
					// Special treatment if the disguise is a player
 | 
			
		||||
					if (disguise.getType() == DisguiseType.PLAYER && disguise instanceof PlayerDisguise)
 | 
			
		||||
						players += ":" + ((PlayerDisguise)disguise).getName();
 | 
			
		||||
					
 | 
			
		||||
					players += ")";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			// Formatting
 | 
			
		||||
			players = "" + ChatColor.AQUA + numPlayers + ChatColor.DARK_AQUA 
 | 
			
		||||
					+ " disguised players:" + players;
 | 
			
		||||
			String entities = ChatColor.DARK_AQUA + "Also " + ChatColor.AQUA 
 | 
			
		||||
					+ numOther + ChatColor.DARK_AQUA + " other diguised entities.";
 | 
			
		||||
			
 | 
			
		||||
			sender.sendMessage(new String[] {players, entities});
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
 | 
			
		||||
		}
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -117,6 +117,11 @@ public class RadiusDisguiseCommand extends BaseDisguiseCommand
 | 
			
		||||
                    + (starting != 0 ? " and EntityType" : ""));
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        else if (args.length < 2)
 | 
			
		||||
		{
 | 
			
		||||
			sender.sendMessage(ChatColor.RED + "You need to supply a radius as well as the disguise");
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        if (!isNumeric(args[starting]))
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user