001 import java.io.IOException; 002 import java.net.InetAddress; 003 import java.net.ServerSocket; 004 import java.util.ArrayList; 005 import java.util.logging.Level; 006 import java.util.logging.Logger; 007 import net.minecraft.server.MinecraftServer; 008 009 public class ev 010 { 011 public static Logger a = Logger.getLogger("Minecraft"); 012 private ServerSocket d; 013 private Thread e; 014 public volatile boolean b = false; 015 private int f = 0; 016 017 private ArrayList g = new ArrayList(); 018 private ArrayList h = new ArrayList(); 019 public MinecraftServer c; 020 021 // hMod: These static methods are here because dx.java is calling them statically... >.> 022 static ServerSocket a(ev self) { return self.d; } 023 static int b(ev self) { return self.f; } 024 static void a(ev self, hc newgi) { ++self.f; self.a(newgi); } 025 026 public ev(MinecraftServer paramMinecraftServer, InetAddress paramInetAddress, int paramInt) 027 { 028 c = paramMinecraftServer; 029 try { 030 d = new ServerSocket(paramInt, 0, paramInetAddress); 031 } catch (IOException ex) { 032 Logger.getLogger(ev.class.getName()).log(Level.SEVERE, null, ex); 033 } 034 d.setPerformancePreferences(0, 2, 1); 035 036 b = true; 037 e = new ek(this, "Listen thread", paramMinecraftServer); 038 039 e.start(); 040 } 041 042 public void a(lp paramlp) 043 { 044 h.add(paramlp); 045 } 046 047 private void a(hc paramhc) { 048 if (paramhc == null) { 049 throw new IllegalArgumentException("Got null pendingconnection!"); 050 } 051 g.add(paramhc); 052 } 053 054 public void a() 055 { 056 Object localObject; 057 for (int i = 0; i < g.size(); i++) { 058 localObject = (hc)g.get(i); 059 try { 060 ((hc)localObject).a(); 061 } catch (Exception localException1) { 062 ((hc)localObject).a("Internal server error"); 063 a.log(Level.WARNING, "Failed to handle packet: " + localException1, localException1); 064 } 065 if (((hc)localObject).c) { 066 g.remove(i--); 067 } 068 } 069 070 for (int i = 0; i < h.size(); i++) { 071 localObject = (lp)h.get(i); 072 try { 073 ((lp)localObject).a(); 074 } catch (Exception localException2) { 075 a.log(Level.WARNING, "Failed to handle packet: " + localException2, localException2); 076 ((lp)localObject).a("Internal server error"); 077 } 078 if (((lp)localObject).c) 079 h.remove(i--); 080 } 081 } 082 }