You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.command.server;
 | 
						|
 | 
						|
import java.util.List;
 | 
						|
import java.util.regex.Matcher;
 | 
						|
import net.minecraft.command.CommandBase;
 | 
						|
import net.minecraft.command.ICommandSender;
 | 
						|
import net.minecraft.command.SyntaxErrorException;
 | 
						|
import net.minecraft.command.WrongUsageException;
 | 
						|
import net.minecraft.server.MinecraftServer;
 | 
						|
 | 
						|
public class CommandPardonIp extends CommandBase
 | 
						|
{
 | 
						|
    private static final String __OBFID = "CL_00000720";
 | 
						|
 | 
						|
    public String getCommandName()
 | 
						|
    {
 | 
						|
        return "pardon-ip";
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Return the required permission level for this command.
 | 
						|
     */
 | 
						|
    public int getRequiredPermissionLevel()
 | 
						|
    {
 | 
						|
        return 3;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns true if the given command sender is allowed to use this command.
 | 
						|
     */
 | 
						|
    public boolean canCommandSenderUseCommand(ICommandSender sender)
 | 
						|
    {
 | 
						|
        return MinecraftServer.getServer().getConfigurationManager().getBannedIPs().func_152689_b() && super.canCommandSenderUseCommand(sender);
 | 
						|
    }
 | 
						|
 | 
						|
    public String getCommandUsage(ICommandSender sender)
 | 
						|
    {
 | 
						|
        return "commands.unbanip.usage";
 | 
						|
    }
 | 
						|
 | 
						|
    public void processCommand(ICommandSender sender, String[] args)
 | 
						|
    {
 | 
						|
        if (args.length == 1 && args[0].length() > 1)
 | 
						|
        {
 | 
						|
            Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);
 | 
						|
 | 
						|
            if (matcher.matches())
 | 
						|
            {
 | 
						|
                MinecraftServer.getServer().getConfigurationManager().getBannedIPs().func_152684_c(args[0]);
 | 
						|
                func_152373_a(sender, this, "commands.unbanip.success", new Object[] {args[0]});
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        else
 | 
						|
        {
 | 
						|
            throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Adds the strings available in this command to the given list of tab completion options.
 | 
						|
     */
 | 
						|
    public List addTabCompletionOptions(ICommandSender sender, String[] args)
 | 
						|
    {
 | 
						|
        return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getBannedIPs().func_152685_a()) : null;
 | 
						|
    }
 | 
						|
} |