<commit_before>package com.ForgeEssentials.permission;

import java.util.ArrayList;

import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;

import com.ForgeEssentials.util.Localization;
import com.ForgeEssentials.util.OutputHandler;
import com.ForgeEssentials.util.AreaSelector.WorldPoint;

public class CommandGroup
{
	public static void processCommandPlayer(EntityPlayer sender, String[] args)
	{
		if (args.length == 0) // display syntax & possible options for this level
		{
			//Make list
			OutputHandler.chatConfirmation(sender, "Possible usage:");
			OutputHandler.chatConfirmation(sender, "/p group create|delete");
			OutputHandler.chatConfirmation(sender, "/p group <groupName>");
			OutputHandler.chatConfirmation(sender, "/p group list ");
			//OutputHandler.chatError(sender, Localization.get(Localization.ERROR_BADSYNTAX) + "");
			return;
		}
		
		/*
		 * Create / remove part
		 *\ /p group create <groupName>
		 */
		if (args[0].equalsIgnoreCase("create") || args[0].equalsIgnoreCase("make"))
		{
			if(args.length == 1)
			{
				OutputHandler.chatConfirmation(sender, "Usage: /p group create <groupname>");
				return;
			}
			Zone zone = ZoneManager.GLOBAL;
			String prefix = "";
			String suffix = "";
			String parent = null;
			int priority = 0;
			if(args.length > 2)
			{
				
				if(ZoneManager.doesZoneExist(args[3]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			PermissionsAPI.createGroupInZone(args[1], zone.getZoneName(), "", "", null, 0);
			sender.sendChatToPlayer("Group " + args[1] + " made in zone " + zone.getZoneName());
			return;
		}
		if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("remove"))
		{
			if(args.length == 1)
			{
				OutputHandler.chatConfirmation(sender, "Usage: /p group delete <groupname>");
				return;
			}
			if(PermissionsAPI.getGroupForName(args[1]) == null)
			{
				OutputHandler.chatError(sender, args[0] + " does not exist as a group!");
				return;
			}
			Zone zone = ZoneManager.GLOBAL;
			if(args.length == 3)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			//Remove zone
			PermissionsAPI.deleteGroupInZone(args[1], zone.getZoneName());
			OutputHandler.chatConfirmation(sender, "Group " + args[1] + " removed in zone " + zone.getZoneName());
			return;
		}
		if(args[0].equalsIgnoreCase("list"))
		{
			// list the current groups: by zone?  in priority order?
			ArrayList list = PermissionsAPI.getGroupsInZone(ZoneManager.GLOBAL.getZoneName());
			Zone zone = ZoneManager.GLOBAL;
			if(args.length == 2)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			OutputHandler.chatConfirmation(sender, "Groups available in zone " + zone.getZoneName() + ":");
			OutputHandler.chatConfirmation(sender, "Group listing is not yet implemented.");
			return;
		}
		
		
		Group group = PermissionsAPI.getGroupForName(args[0]);
		if (group == null)
		{
			OutputHandler.chatError(sender, args[0] + " does not exist as a group!");
			return;
		}
		if (args.length == 1) // display group-specific settings and their values for this group
		{
			OutputHandler.chatConfirmation(sender, "Current settings for " + group.name + ": prefix=" + group.prefix + ", suffix=" + group.suffix + ", parent=" + group.parent + ", priority=" + group.priority);
			OutputHandler.chatConfirmation(sender, "To change any of these, type /p group <groupname> prefix|suffix|parent|priority set <value>");
			return;
		}
		/*
		 * Settings
		 */
		Zone zone = ZoneManager.GLOBAL;
		if(args.length == 3 && (args[1].equalsIgnoreCase("prefix") || args[1].equalsIgnoreCase("suffix")
				|| args[1].equalsIgnoreCase("parent") || args[1].equalsIgnoreCase("priority")))
		{
			if(args.length == 3)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[2].equalsIgnoreCase("here"))
				{<commit_msg>Oops.  Forgot to remove the message saying it wasn't available.<commit_after>package com.ForgeEssentials.permission;

import java.util.ArrayList;

import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;

import com.ForgeEssentials.util.Localization;
import com.ForgeEssentials.util.OutputHandler;
import com.ForgeEssentials.util.AreaSelector.WorldPoint;

public class CommandGroup
{
	public static void processCommandPlayer(EntityPlayer sender, String[] args)
	{
		if (args.length == 0) // display syntax & possible options for this level
		{
			//Make list
			OutputHandler.chatConfirmation(sender, "Possible usage:");
			OutputHandler.chatConfirmation(sender, "/p group create|delete");
			OutputHandler.chatConfirmation(sender, "/p group <groupName>");
			OutputHandler.chatConfirmation(sender, "/p group list ");
			//OutputHandler.chatError(sender, Localization.get(Localization.ERROR_BADSYNTAX) + "");
			return;
		}
		
		/*
		 * Create / remove part
		 *\ /p group create <groupName>
		 */
		if (args[0].equalsIgnoreCase("create") || args[0].equalsIgnoreCase("make"))
		{
			if(args.length == 1)
			{
				OutputHandler.chatConfirmation(sender, "Usage: /p group create <groupname>");
				return;
			}
			Zone zone = ZoneManager.GLOBAL;
			String prefix = "";
			String suffix = "";
			String parent = null;
			int priority = 0;
			if(args.length > 2)
			{
				
				if(ZoneManager.doesZoneExist(args[3]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			PermissionsAPI.createGroupInZone(args[1], zone.getZoneName(), "", "", null, 0);
			sender.sendChatToPlayer("Group " + args[1] + " made in zone " + zone.getZoneName());
			return;
		}
		if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("remove"))
		{
			if(args.length == 1)
			{
				OutputHandler.chatConfirmation(sender, "Usage: /p group delete <groupname>");
				return;
			}
			if(PermissionsAPI.getGroupForName(args[1]) == null)
			{
				OutputHandler.chatError(sender, args[0] + " does not exist as a group!");
				return;
			}
			Zone zone = ZoneManager.GLOBAL;
			if(args.length == 3)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			//Remove zone
			PermissionsAPI.deleteGroupInZone(args[1], zone.getZoneName());
			OutputHandler.chatConfirmation(sender, "Group " + args[1] + " removed in zone " + zone.getZoneName());
			return;
		}
		if(args[0].equalsIgnoreCase("list"))
		{
			// list the current groups: by zone?  in priority order?
			ArrayList list = PermissionsAPI.getGroupsInZone(ZoneManager.GLOBAL.getZoneName());
			Zone zone = ZoneManager.GLOBAL;
			if(args.length == 2)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[3].equalsIgnoreCase("here"))
				{
					zone = ZoneManager.getWhichZoneIn(new WorldPoint(sender));
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[2]));
				}
			}
			OutputHandler.chatConfirmation(sender, "Groups available in zone " + zone.getZoneName() + ":");
			return;
		}
		
		
		Group group = PermissionsAPI.getGroupForName(args[0]);
		if (group == null)
		{
			OutputHandler.chatError(sender, args[0] + " does not exist as a group!");
			return;
		}
		if (args.length == 1) // display group-specific settings and their values for this group
		{
			OutputHandler.chatConfirmation(sender, "Current settings for " + group.name + ": prefix=" + group.prefix + ", suffix=" + group.suffix + ", parent=" + group.parent + ", priority=" + group.priority);
			OutputHandler.chatConfirmation(sender, "To change any of these, type /p group <groupname> prefix|suffix|parent|priority set <value>");
			return;
		}
		/*
		 * Settings
		 */
		Zone zone = ZoneManager.GLOBAL;
		if(args.length == 3 && (args[1].equalsIgnoreCase("prefix") || args[1].equalsIgnoreCase("suffix")
				|| args[1].equalsIgnoreCase("parent") || args[1].equalsIgnoreCase("priority")))
		{
			if(args.length == 3)
			{
				if(ZoneManager.doesZoneExist(args[2]))
				{
					zone = ZoneManager.getZone(args[2]);
				}
				else if(args[2].equalsIgnoreCase("here"))
				{
{'fraction_non_alphanumeric': 0.14509261230572706, 'fraction_numerical': 0.009154779646582926, 'mean_word_length': 3.771457592686643, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1792638', 'n_tokens_mistral': 3621, 'n_tokens_neox': 2995, 'n_words': 558}