public class EZZonePerm
{
public EZZonePerm(String[] data, CommandSender sender)
{
EpicZonePlayer ezp;
if (sender instanceof Player)
{
ezp = General.getPlayer(sender.getName());
}
else
{
ezp = General.getPlayer("console");
}
if (ezp.getMode() == EpicZoneMode.ZoneEdit)
{
if (data.length > 3)
{
String member = data[1];
String node = data[2];
String perm = data[3];
if (ValidNode(node))
{
if (ValidPerm(perm))
{
if (node.equals("command"))
{
if (data.length > 4)
{
String command = data[4].toLowerCase();
if (perm.equals("allow"))
{
ezp.getEditZone().getDisallowedCommands().remove(command);
Message.Send(sender, Message_ID.Info_00131_CommandNotDenied, new String[]{command, ezp.getEditZone().getName()});
}
else
{
ezp.getEditZone().getDisallowedCommands().add(command);
Message.Send(sender, Message_ID.Info_00132_CommandDenied, new String[]{command, ezp.getEditZone().getName()});
}
}
else
{
new EZZoneHelp(ZoneCommand.PERM, sender, ezp);
}
}
else
{
ezp.getEditZone().addPermission(member, node, perm);
Message.Send(sender, Message_ID.Info_00109_PermissionAdded, new String[]{member, node, perm});
}
}
else
{
Message.Send(sender, Message_ID.Warning_00110_InvalidPermissionType, new String[]{perm});
}
}
else
{
Message.Send(sender, Message_ID.Warning_00111_InvalidPermissionNode, new String[]{node});
}
}
else if (data.length > 2)
{
String cmd = data[1];
String tag = data[2];
if (cmd.equalsIgnoreCase("copy"))
{
EpicZone srcZone = General.myZones.get(tag);
if (srcZone != null)
{
for (String permTag : srcZone.getPermissions().keySet())
{
EpicZonePermission perm = srcZone.getPermissions().get(permTag);
ezp.getEditZone().addPermission(perm.getMember(), perm.getNode().toString(), perm.getPermission().toString());
}
Message.Send(sender, Message_ID.Info_00128_CopiedPermissions, new String[]{tag});
}
else
{
Message.Send(sender, Message_ID.Warning_00117_Zone_X_DoesNotExist, new String[]{tag});
}
}
else if (cmd.equalsIgnoreCase("clear"))
{
ArrayList<EpicZonePermission> remPerms = new ArrayList<EpicZonePermission>();
for (String permTag : ezp.getEditZone().getPermissions().keySet())
{
EpicZonePermission perm = ezp.getEditZone().getPermissions().get(permTag);
if (perm.getMember().equalsIgnoreCase(tag))
{
remPerms.add(perm);
}
}
for (EpicZonePermission perm : remPerms)
{
ezp.getEditZone().removePermission(perm.getMember(), perm.getNode().toString(), perm.getPermission().toString());
}
Message.Send(sender, Message_ID.Info_00129_PermissionsClearedFor_X, new String[]{tag});
}
}
else if (data.length > 1)
{
String cmd = data[1];
if (cmd.equalsIgnoreCase("clear"))
{
ezp.getEditZone().setPermissions(new HashMap<String, EpicZonePermission>());
}
Message.Send(sender, Message_ID.Info_00040_PermissionsCleared);
}
else
{