/** Called when a CommandSender executes this command */
  public void execute(ICommandSender sender, String[] args) throws CommandException {
    if (args.length >= 1 && args[0].length() > 1) {
      IChatComponent ichatcomponent =
          args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
      Matcher matcher = field_147211_a.matcher(args[0]);

      if (matcher.matches()) {
        this.func_147210_a(
            sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
      } else {
        EntityPlayerMP entityplayermp =
            MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

        if (entityplayermp == null) {
          throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
        }

        this.func_147210_a(
            sender,
            entityplayermp.getPlayerIP(),
            ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
      }
    } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
  }
Exemple #2
0
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 1) {
      Matcher var3 = field_147211_a.matcher(par2ArrayOfStr[0]);
      IChatComponent var4 = null;

      if (par2ArrayOfStr.length >= 2) {
        var4 = func_147178_a(par1ICommandSender, par2ArrayOfStr, 1);
      }

      if (var3.matches()) {
        this.func_147210_a(
            par1ICommandSender, par2ArrayOfStr[0], var4 == null ? null : var4.getUnformattedText());
      } else {
        EntityPlayerMP var5 =
            MinecraftServer.getServer()
                .getConfigurationManager()
                .getPlayerEntity(par2ArrayOfStr[0]);

        if (var5 == null) {
          throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
        }

        this.func_147210_a(
            par1ICommandSender,
            var5.getPlayerIP(),
            var4 == null ? null : var4.getUnformattedText());
      }
    } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
  }
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 1) {
      Matcher matcher = IPv4Pattern.matcher(par2ArrayOfStr[0]);
      String s = null;

      if (par2ArrayOfStr.length >= 2) {
        s = func_82360_a(par1ICommandSender, par2ArrayOfStr, 1);
      }

      if (matcher.matches()) {
        this.banIP(par1ICommandSender, par2ArrayOfStr[0], s);
      } else {
        EntityPlayerMP entityplayermp =
            MinecraftServer.getServer()
                .getConfigurationManager()
                .getPlayerForUsername(par2ArrayOfStr[0]);

        if (entityplayermp == null) {
          throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
        }

        this.banIP(par1ICommandSender, entityplayermp.getPlayerIP(), s);
      }
    } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
  }
  public List getPlayersMatchingAddress(String address) {
    ArrayList var2 = Lists.newArrayList();
    Iterator var3 = this.playerEntityList.iterator();

    while (var3.hasNext()) {
      EntityPlayerMP var4 = (EntityPlayerMP) var3.next();

      if (var4.getPlayerIP().equals(address)) {
        var2.add(var4);
      }
    }

    return var2;
  }