Пример #1
0
  public void func_73703_b(boolean p_73703_1_) {
    this.func_73705_d();

    try {
      PrintWriter var2 = new PrintWriter(new FileWriter(this.field_73713_b, false));
      if (p_73703_1_) {
        var2.println(
            "# Updated "
                + (new SimpleDateFormat()).format(new Date())
                + " by Minecraft "
                + "1.6.4");
        var2.println("# victim name | ban date | banned by | banned until | reason");
        var2.println();
      }

      Iterator var3 = this.field_73715_a.values().iterator();

      while (var3.hasNext()) {
        BanEntry var4 = (BanEntry) var3.next();
        var2.println(var4.func_73685_g());
      }

      var2.close();
    } catch (IOException var5) {
      MinecraftServer.func_71276_C().func_98033_al().func_98234_c("Could not save ban list", var5);
    }
  }
Пример #2
0
  public void func_73707_e() {
    if (this.field_73713_b.isFile()) {
      BufferedReader var1;
      try {
        var1 = new BufferedReader(new FileReader(this.field_73713_b));
      } catch (FileNotFoundException var4) {
        throw new Error();
      }

      String var2;
      try {
        while ((var2 = var1.readLine()) != null) {
          if (!var2.startsWith("#")) {
            BanEntry var3 = BanEntry.func_73688_c(var2);
            if (var3 != null) {
              this.field_73715_a.func_76116_a(var3.func_73684_a(), var3);
            }
          }
        }
      } catch (IOException var5) {
        MinecraftServer.func_71276_C()
            .func_98033_al()
            .func_98234_c("Could not load ban list", var5);
      }
    }
  }
Пример #3
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)});
    }
  }
Пример #4
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.func_73687_a(p_147210_1_.func_70005_c_());
    if (p_147210_3_ != null) {
      var4.func_73689_b(p_147210_3_);
    }

    MinecraftServer.func_71276_C().func_71203_ab().func_72363_f().func_73706_a(var4);
    List var5 = MinecraftServer.func_71276_C().func_71203_ab().func_72382_j(p_147210_2_);
    String[] var6 = new String[var5.size()];
    int var7 = 0;

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

    if (var5.isEmpty()) {
      func_71522_a(p_147210_1_, "commands.banip.success", new Object[] {p_147210_2_});
    } else {
      func_71522_a(
          p_147210_1_,
          "commands.banip.success.players",
          new Object[] {p_147210_2_, func_71527_a(var6)});
    }
  }
Пример #5
0
  /** 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)});
    }
  }
Пример #6
0
  public void func_73705_d() {
    Iterator var1 = this.field_73715_a.values().iterator();

    while (var1.hasNext()) {
      BanEntry var2 = (BanEntry) var1.next();
      if (var2.func_73682_e()) {
        var1.remove();
      }
    }
  }
Пример #7
0
 public void func_73706_a(BanEntry p_73706_1_) {
   this.field_73715_a.func_76116_a(p_73706_1_.func_73684_a(), p_73706_1_);
   this.func_73711_f();
 }