Java 类net.minecraft.server.management.BanEntry 实例源码

项目:RuneCraftery    文件:NetServerHandler.java   
public void func_72458_a(Packet205ClientCommand p_72458_1_) {
   this.field_72574_e.func_143004_u();
   if(p_72458_1_.field_73447_a == 1) {
      if(this.field_72574_e.field_71136_j) {
         this.field_72574_e = this.field_72573_d.func_71203_ab().func_72368_a(this.field_72574_e, 0, true);
      } else if(this.field_72574_e.func_71121_q().func_72912_H().func_76093_s()) {
         if(this.field_72573_d.func_71264_H() && this.field_72574_e.func_70005_c_().equals(this.field_72573_d.func_71214_G())) {
            this.field_72574_e.field_71135_a.func_72565_c("You have died. Game over, man, it\'s game over!");
            this.field_72573_d.func_71272_O();
         } else {
            BanEntry var2 = new BanEntry(this.field_72574_e.func_70005_c_());
            var2.func_73689_b("Death in Hardcore");
            this.field_72573_d.func_71203_ab().func_72390_e().func_73706_a(var2);
            this.field_72574_e.field_71135_a.func_72565_c("You have died. Game over, man, it\'s game over!");
         }
      } else {
         if(this.field_72574_e.func_110143_aJ() > 0.0F) {
            return;
         }

         this.field_72574_e = this.field_72573_d.func_71203_ab().func_72368_a(this.field_72574_e, 0, false);
      }
   }

}
项目:RuneCraftery    文件:BanList.java   
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);
      }

   }
}
项目:RuneCraftery    文件:BanList.java   
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);
   }

}
项目:RuneCraftery    文件:CommandServerBan.java   
public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   if(p_71515_2_.length >= 1 && p_71515_2_[0].length() > 0) {
      EntityPlayerMP var3 = MinecraftServer.func_71276_C().func_71203_ab().func_72361_f(p_71515_2_[0]);
      BanEntry var4 = new BanEntry(p_71515_2_[0]);
      var4.func_73687_a(p_71515_1_.func_70005_c_());
      if(p_71515_2_.length >= 2) {
         var4.func_73689_b(func_82360_a(p_71515_1_, p_71515_2_, 1));
      }

      MinecraftServer.func_71276_C().func_71203_ab().func_72390_e().func_73706_a(var4);
      if(var3 != null) {
         var3.field_71135_a.func_72565_c("You are banned from this server.");
      }

      func_71522_a(p_71515_1_, "commands.ban.success", new Object[]{p_71515_2_[0]});
   } else {
      throw new WrongUsageException("commands.ban.usage", new Object[0]);
   }
}
项目:RuneCraftery    文件:CommandServerBanIp.java   
protected void func_71544_a(ICommandSender p_71544_1_, String p_71544_2_, String p_71544_3_) {
   BanEntry var4 = new BanEntry(p_71544_2_);
   var4.func_73687_a(p_71544_1_.func_70005_c_());
   if(p_71544_3_ != null) {
      var4.func_73689_b(p_71544_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_71544_2_);
   String[] var6 = new String[var5.size()];
   int var7 = 0;

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

   if(var5.isEmpty()) {
      func_71522_a(p_71544_1_, "commands.banip.success", new Object[]{p_71544_2_});
   } else {
      func_71522_a(p_71544_1_, "commands.banip.success.players", new Object[]{p_71544_2_, func_71527_a(var6)});
   }

}
项目:Resilience-Client-Source    文件:CommandBanIp.java   
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)});
    }
}
项目:Resilience-Client-Source    文件:CommandBanPlayer.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 0)
    {
        EntityPlayerMP var3 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]);
        BanEntry var4 = new BanEntry(par2ArrayOfStr[0]);
        var4.setBannedBy(par1ICommandSender.getCommandSenderName());

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

        MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().put(var4);

        if (var3 != null)
        {
            var3.playerNetServerHandler.kickPlayerFromServer("You are banned from this server.");
        }

        notifyAdmins(par1ICommandSender, "commands.ban.success", new Object[] {par2ArrayOfStr[0]});
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage", new Object[0]);
    }
}
项目:RuneCraftery    文件:BanList.java   
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();
      }
   }

}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public String func_72399_a(SocketAddress p_72399_1_, String p_72399_2_) {
   if(this.field_72401_g.func_73704_a(p_72399_2_)) {
      BanEntry var6 = (BanEntry)this.field_72401_g.func_73712_c().get(p_72399_2_);
      String var7 = "You are banned from this server!\nReason: " + var6.func_73686_f();
      if(var6.func_73680_d() != null) {
         var7 = var7 + "\nYour ban will be removed on " + field_72403_e.format(var6.func_73680_d());
      }

      return var7;
   } else if(!this.func_72370_d(p_72399_2_)) {
      return "You are not white-listed on this server!";
   } else {
      String var3 = p_72399_1_.toString();
      var3 = var3.substring(var3.indexOf("/") + 1);
      var3 = var3.substring(0, var3.indexOf(":"));
      if(this.field_72413_h.func_73704_a(var3)) {
         BanEntry var4 = (BanEntry)this.field_72413_h.func_73712_c().get(var3);
         String var5 = "Your IP address is banned from this server!\nReason: " + var4.func_73686_f();
         if(var4.func_73680_d() != null) {
            var5 = var5 + "\nYour ban will be removed on " + field_72403_e.format(var4.func_73680_d());
         }

         return var5;
      } else {
         return this.field_72404_b.size() >= this.field_72405_c?"The server is full!":null;
      }
   }
}
项目:RuneCraftery    文件:NetServerHandler.java   
public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand)
{
    this.playerEntity.func_143004_u();

    if (par1Packet205ClientCommand.forceRespawn == 1)
    {
        if (this.playerEntity.playerConqueredTheEnd)
        {
            this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, true);
        }
        else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled())
        {
            if (this.mcServer.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.mcServer.getServerOwner()))
            {
                this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
                this.mcServer.deleteWorldAndStopServer();
            }
            else
            {
                BanEntry banentry = new BanEntry(this.playerEntity.getCommandSenderName());
                banentry.setBanReason("Death in Hardcore");
                this.mcServer.getConfigurationManager().getBannedPlayers().put(banentry);
                this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
            }
        }
        else
        {
            if (this.playerEntity.getHealth() > 0.0F)
            {
                return;
            }

            this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, playerEntity.dimension, false);
        }
    }
}
项目:RuneCraftery    文件:CommandServerBan.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 0)
    {
        EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]);
        BanEntry banentry = new BanEntry(par2ArrayOfStr[0]);
        banentry.setBannedBy(par1ICommandSender.getCommandSenderName());

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

        MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().put(banentry);

        if (entityplayermp != null)
        {
            entityplayermp.playerNetServerHandler.kickPlayerFromServer("You are banned from this server.");
        }

        notifyAdmins(par1ICommandSender, "commands.ban.success", new Object[] {par2ArrayOfStr[0]});
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage", new Object[0]);
    }
}
项目:RuneCraftery    文件:CommandServerBanIp.java   
/**
 * 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)});
    }
}
项目:BetterNutritionMod    文件:NetServerHandler.java   
public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand)
{
    this.playerEntity.func_143004_u();

    if (par1Packet205ClientCommand.forceRespawn == 1)
    {
        if (this.playerEntity.playerConqueredTheEnd)
        {
            this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, true);
        }
        else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled())
        {
            if (this.mcServer.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.mcServer.getServerOwner()))
            {
                this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
                this.mcServer.deleteWorldAndStopServer();
            }
            else
            {
                BanEntry banentry = new BanEntry(this.playerEntity.getCommandSenderName());
                banentry.setBanReason("Death in Hardcore");
                this.mcServer.getConfigurationManager().getBannedPlayers().put(banentry);
                this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
            }
        }
        else
        {
            if (this.playerEntity.getHealth() > 0.0F)
            {
                return;
            }

            this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, playerEntity.dimension, false);
        }
    }
}
项目:BetterNutritionMod    文件:CommandServerBan.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 0)
    {
        EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]);
        BanEntry banentry = new BanEntry(par2ArrayOfStr[0]);
        banentry.setBannedBy(par1ICommandSender.getCommandSenderName());

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

        MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().put(banentry);

        if (entityplayermp != null)
        {
            entityplayermp.playerNetServerHandler.kickPlayerFromServer("You are banned from this server.");
        }

        notifyAdmins(par1ICommandSender, "commands.ban.success", new Object[] {par2ArrayOfStr[0]});
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage", new Object[0]);
    }
}
项目:BetterNutritionMod    文件:CommandServerBanIp.java   
/**
 * 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)});
    }
}
项目:Nucleum-Omnium    文件:CommandBan.java   
@Override
public void processCommand(final ICommandSender sender, final String[] args)
{
    if ((args.length >= 1) && (args[0].length() > 0))
    {
        EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(args[0]);
        BanEntry banentry = new BanEntry(args[0]);
        banentry.setBannedBy(sender.getCommandSenderName());
        StringBuilder sb = new StringBuilder();
        sb.append("You have been banned from the server for ");
        if (args.length >= 2)
        {
            banentry.setBanReason(func_82360_a(sender, args, 1));
        }
        if (args.length >= 4)
        {
            if (JavaHelper.isNumeric(args[2]))
            {
                TimeUnit scale = getUnit(args[3]);
                banentry.setBanEndDate(JavaHelper.getDate(scale, Integer.parseInt(args[3])));
                sb.append(args[3]);
                sb.append(" ");
                sb.append(scale.name());
            }
        }
        MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().put(banentry);
        if (entityplayermp != null)
        {
            entityplayermp.playerNetServerHandler.kickPlayerFromServer(sb.toString());
        }
        notifyAdmins(sender, "commands.ban.success", args[0]);
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage");
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayServer.java   
/**
 * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or
 * acquiring 'open inventory' achievement
 */
public void processClientStatus(C16PacketClientStatus p_147342_1_)
{
    this.playerEntity.func_143004_u();
    C16PacketClientStatus.EnumState var2 = p_147342_1_.func_149435_c();

    switch (NetHandlerPlayServer.SwitchEnumState.field_151290_a[var2.ordinal()])
    {
        case 1:
            if (this.playerEntity.playerConqueredTheEnd)
            {
                this.playerEntity = this.serverController.getConfigurationManager().respawnPlayer(this.playerEntity, 0, true);
            }
            else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled())
            {
                if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner()))
                {
                    this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
                    this.serverController.deleteWorldAndStopServer();
                }
                else
                {
                    BanEntry var3 = new BanEntry(this.playerEntity.getCommandSenderName());
                    var3.setBanReason("Death in Hardcore");
                    this.serverController.getConfigurationManager().getBannedPlayers().put(var3);
                    this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!");
                }
            }
            else
            {
                if (this.playerEntity.getHealth() > 0.0F)
                {
                    return;
                }

                this.playerEntity = this.serverController.getConfigurationManager().respawnPlayer(this.playerEntity, 0, false);
            }

            break;

        case 2:
            this.playerEntity.func_147099_x().func_150876_a(this.playerEntity);
            break;

        case 3:
            this.playerEntity.triggerAchievement(AchievementList.openInventory);
    }
}
项目:RuneCraftery    文件:BanList.java   
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();
}