Beispiel #1
0
  protected void func_147210_a(ICommandSender p_147210_1_, String p_147210_2_, String p_147210_3_) {
    BanEntry var4 = new BanEntry(p_147210_2_);
    var4.setBannedBy(p_147210_1_.getCommandSenderName());

    if (p_147210_3_ != null) {
      var4.setBanReason(p_147210_3_);
    }

    MinecraftServer.getServer().getConfigurationManager().getBannedIPs().put(var4);
    List var5 = MinecraftServer.getServer().getConfigurationManager().getPlayerList(p_147210_2_);
    String[] var6 = new String[var5.size()];
    int var7 = 0;
    EntityPlayerMP var9;

    for (Iterator var8 = var5.iterator();
        var8.hasNext();
        var6[var7++] = var9.getCommandSenderName()) {
      var9 = (EntityPlayerMP) var8.next();
      var9.playerNetServerHandler.kickPlayerFromServer("You have been IP banned.");
    }

    if (var5.isEmpty()) {
      notifyAdmins(p_147210_1_, "commands.banip.success", new Object[] {p_147210_2_});
    } else {
      notifyAdmins(
          p_147210_1_,
          "commands.banip.success.players",
          new Object[] {p_147210_2_, joinNiceString(var6)});
    }
  }
  /** Actually does the banning work. */
  protected void banIP(ICommandSender par1ICommandSender, String par2Str, String par3Str) {
    BanEntry banentry = new BanEntry(par2Str);
    banentry.setBannedBy(par1ICommandSender.getCommandSenderName());

    if (par3Str != null) {
      banentry.setBanReason(par3Str);
    }

    MinecraftServer.getServer().getConfigurationManager().getBannedIPs().put(banentry);
    List list = MinecraftServer.getServer().getConfigurationManager().getPlayerList(par2Str);
    String[] astring = new String[list.size()];
    int i = 0;
    EntityPlayerMP entityplayermp;

    for (Iterator iterator = list.iterator();
        iterator.hasNext();
        astring[i++] = entityplayermp.getEntityName()) {
      entityplayermp = (EntityPlayerMP) iterator.next();
      entityplayermp.playerNetServerHandler.kickPlayerFromServer("You have been IP banned.");
    }

    if (list.isEmpty()) {
      notifyAdmins(par1ICommandSender, "commands.banip.success", new Object[] {par2Str});
    } else {
      notifyAdmins(
          par1ICommandSender,
          "commands.banip.success.players",
          new Object[] {par2Str, joinNiceString(astring)});
    }
  }