<commit_before>package com.ForgeEssentials.permission;

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

import java.util.ArrayList;

import com.ForgeEssentials.core.PlayerInfo;
import com.ForgeEssentials.util.FunctionHelper;
import com.ForgeEssentials.util.Localization;
import com.ForgeEssentials.util.OutputHandler;

public class CommandFEPermUser
{
	public static void processCommandPlayer(EntityPlayer sender, String[] args)
	{
		if (args.length == 0) // display syntax & possible options for this level
		{
			OutputHandler.chatConfirmation(sender, "Possible usage:");
			OutputHandler.chatConfirmation(sender, "/p user <player> : Display user statistics");
			OutputHandler.chatConfirmation(sender, "/p user <player> supers : Player's superperms");
			OutputHandler.chatConfirmation(sender, "/p user <player> group : Player's group settings");
			OutputHandler.chatConfirmation(sender, "/p user <player> allow|true|deny|false|clear : Player's individual permissions");
			return;
		}
		
		boolean playerExists = true;
		String playerName = args[0];
		EntityPlayerMP player = FunctionHelper.getPlayerFromUsername(args[0]);
		if (playerName.equalsIgnoreCase("_ME_"))
		{
			player = (EntityPlayerMP) sender;
			playerName = sender.username;
		}
		else if (player == null)
		{
			OutputHandler.chatError(sender, Localization.format(Localization.ERROR_NOPLAYER, args[0]));
			OutputHandler.chatConfirmation(sender, args[0] + " will be used, but may be inaccurate.");
			playerExists = false;
		}
		else
		{
			playerName = player.username;
		}
		
		if (args.length == 1) // display user-specific settings & there values for this player
		{
			ArrayList<Group> groups = PermissionsAPI.getApplicableGroups(args[0], false, ZoneManager.GLOBAL.getZoneName());
			OutputHandler.chatConfirmation(sender, Localization.format("command.permissions.user.info.groups", player.username));
			for (Group g : groups)
			{
				OutputHandler.chatConfirmation(sender, " - "+g.name+" -- "+g.zoneName);
			}
			return;
		}
		else if (args[1].equalsIgnoreCase("supers")) // super perms management
		{
			if (args.length == 2) // display user super perms
			{
				Zone zone = ZoneManager.SUPER;
				ArrayList list = PermissionsAPI.getPlayerPermissions(args[0], zone.getZoneName());
				boolean error = false;
				for(Object lineObj : list)
				{
					String line = (String)lineObj;
					if(line.equalsIgnoreCase("error"))
					{
						error = true;
						continue;
					}
					if(error)
					{
						OutputHandler.chatError(sender, line);
					}
					else
					{
						OutputHandler.chatConfirmation(sender, line);
					}
				}
				return;
			}
			else if (args.length >= 3) // changing super perms
			{
				Zone zone = ZoneManager.SUPER;
				if (args.length == 5) // zone is set
				{
					if(ZoneManager.doesZoneExist(args[4]))
					{
						zone = ZoneManager.getZone(args[4]);
					}
					else
					{
						OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[4]));
					}
				}
				
				if (args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("allow"))
				{
					PermissionsAPI.setPlayerPermission(playerName, args[3], true, zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + " has been allowed " + args[3]);
					return;
				}
				else if (args[2].equalsIgnoreCase("clear") || args[2].equalsIgnoreCase("remove")) // remove super
																									// perm settings
				{
					PermissionsAPI.clearPlayerPermission(playerName, args[3], zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + "'s access to " + args[2] + " cleared");
					return;
				}
				else if (args[2].equalsIgnoreCase("false") || args[2].equalsIgnoreCase("deny")) // deny super perm
				{
					PermissionsAPI.setPlayerPermission(playerName, args[3], false, zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + " has been denied " + args[3]);
					return;
				}
				else if (args[2].equalsIgnoreCase("get"))
				{
					//Get current state.
					return;
				}
				
			}
		}
		else if (args[1].equalsIgnoreCase("group")) // group management
		{
			String zoneName = ZoneManager.GLOBAL.getZoneName();
			if (args.length == 5) // zone is set
			{
				if(ZoneManager.getZone(args[4]) != null)
				{
					zoneName = args[4];
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[4]));
					return;
				}
			}<commit_msg>Fix for /p user <user> group (added usage).<commit_after>package com.ForgeEssentials.permission;

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

import java.util.ArrayList;

import com.ForgeEssentials.core.PlayerInfo;
import com.ForgeEssentials.util.FunctionHelper;
import com.ForgeEssentials.util.Localization;
import com.ForgeEssentials.util.OutputHandler;

public class CommandFEPermUser
{
	public static void processCommandPlayer(EntityPlayer sender, String[] args)
	{
		if (args.length == 0) // display syntax & possible options for this level
		{
			OutputHandler.chatConfirmation(sender, "Possible usage:");
			OutputHandler.chatConfirmation(sender, "/p user <player> : Display user statistics");
			OutputHandler.chatConfirmation(sender, "/p user <player> supers : Player's superperms");
			OutputHandler.chatConfirmation(sender, "/p user <player> group : Player's group settings");
			OutputHandler.chatConfirmation(sender, "/p user <player> allow|true|deny|false|clear : Player's individual permissions");
			return;
		}
		
		boolean playerExists = true;
		String playerName = args[0];
		EntityPlayerMP player = FunctionHelper.getPlayerFromUsername(args[0]);
		if (playerName.equalsIgnoreCase("_ME_"))
		{
			player = (EntityPlayerMP) sender;
			playerName = sender.username;
		}
		else if (player == null)
		{
			OutputHandler.chatError(sender, Localization.format(Localization.ERROR_NOPLAYER, args[0]));
			OutputHandler.chatConfirmation(sender, args[0] + " will be used, but may be inaccurate.");
			playerExists = false;
		}
		else
		{
			playerName = player.username;
		}
		
		if (args.length == 1) // display user-specific settings & there values for this player
		{
			ArrayList<Group> groups = PermissionsAPI.getApplicableGroups(args[0], false, ZoneManager.GLOBAL.getZoneName());
			OutputHandler.chatConfirmation(sender, Localization.format("command.permissions.user.info.groups", player.username));
			for (Group g : groups)
			{
				OutputHandler.chatConfirmation(sender, " - "+g.name+" -- "+g.zoneName);
			}
			return;
		}
		else if (args[1].equalsIgnoreCase("supers")) // super perms management
		{
			if (args.length == 2) // display user super perms
			{
				Zone zone = ZoneManager.SUPER;
				ArrayList list = PermissionsAPI.getPlayerPermissions(args[0], zone.getZoneName());
				boolean error = false;
				for(Object lineObj : list)
				{
					String line = (String)lineObj;
					if(line.equalsIgnoreCase("error"))
					{
						error = true;
						continue;
					}
					if(error)
					{
						OutputHandler.chatError(sender, line);
					}
					else
					{
						OutputHandler.chatConfirmation(sender, line);
					}
				}
				return;
			}
			else if (args.length >= 3) // changing super perms
			{
				Zone zone = ZoneManager.SUPER;
				if (args.length == 5) // zone is set
				{
					if(ZoneManager.doesZoneExist(args[4]))
					{
						zone = ZoneManager.getZone(args[4]);
					}
					else
					{
						OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[4]));
					}
				}
				
				if (args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("allow"))
				{
					PermissionsAPI.setPlayerPermission(playerName, args[3], true, zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + " has been allowed " + args[3]);
					return;
				}
				else if (args[2].equalsIgnoreCase("clear") || args[2].equalsIgnoreCase("remove")) // remove super
																									// perm settings
				{
					PermissionsAPI.clearPlayerPermission(playerName, args[3], zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + "'s access to " + args[2] + " cleared");
					return;
				}
				else if (args[2].equalsIgnoreCase("false") || args[2].equalsIgnoreCase("deny")) // deny super perm
				{
					PermissionsAPI.setPlayerPermission(playerName, args[3], false, zone.getZoneName());
					OutputHandler.chatConfirmation(sender, playerName + " has been denied " + args[3]);
					return;
				}
				else if (args[2].equalsIgnoreCase("get"))
				{
					//Get current state.
					return;
				}
				
			}
		}
		else if (args[1].equalsIgnoreCase("group")) // group management
		{
			if(args.length == 2)
			{
				OutputHandler.chatConfirmation(sender, "/p user <player> group add : Adds them to specified group.");
				OutputHandler.chatConfirmation(sender, "/p user <player> group remove : Removes player from specified group.");
				OutputHandler.chatConfirmation(sender, "/p user <player> group set : Removes player from all groups and adds them to specified group.");
			}
			String zoneName = ZoneManager.GLOBAL.getZoneName();
			if (args.length == 5) // zone is set
			{
				if(ZoneManager.getZone(args[4]) != null)
				{
					zoneName = args[4];
				}
				else
				{
					OutputHandler.chatError(sender, Localization.format(Localization.ERROR_ZONE_NOZONE, args[4]));
					return;
				}
			}
{'fraction_non_alphanumeric': 0.12829119899297178, 'fraction_numerical': 0.0070282177698520925, 'mean_word_length': 3.544327931363203, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '830869', 'n_tokens_mistral': 3568, 'n_tokens_neox': 2872, 'n_words': 608}