public override void run() { try { string s = NetLoginHandler.getServerId(loginHandler); var url = new URL( (new StringBuilder()).append("http://www.minecraft.net/game/checkserver.jsp?user="******"&serverId=").append(s).toString()); var bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); string s1 = bufferedreader.readLine(); bufferedreader.close(); if (s1.Equals("YES")) { NetLoginHandler.setLoginPacket(loginHandler, loginPacket); } else { loginHandler.kickUser("Failed to verify username!"); } } catch (Exception exception) { exception.printStackTrace(); } }
public EntityPlayerMP login(NetLoginHandler netloginhandler, string s, string s1) { if (bannedPlayers.contains(s.Trim().ToLower())) { netloginhandler.kickUser("You are banned from this server!"); return(null); } if (!isAllowedToLogin(s)) { netloginhandler.kickUser("You are not white-listed on this server!"); return(null); } string s2 = netloginhandler.netManager.getRemoteAddress().toString(); s2 = s2.Substring(s2.IndexOf("/") + 1); s2 = s2.Substring(0, s2.IndexOf(":")); if (bannedIPs.contains(s2)) { netloginhandler.kickUser("Your IP address is banned from this server!"); return(null); } if (playerEntities.size() >= maxPlayers) { netloginhandler.kickUser("The server is full!"); return(null); } for (int i = 0; i < playerEntities.size(); i++) { var entityplayermp = (EntityPlayerMP)playerEntities.get(i); if (entityplayermp.username.ToLowerInvariant() == s.ToLowerInvariant()) { entityplayermp.playerNetServerHandler.kickPlayer("You logged in from another location"); } } return(new EntityPlayerMP(mcServer, mcServer.worldMngr, s, new ItemInWorldManager(mcServer.worldMngr))); }
public EntityPlayerMP login(NetLoginHandler netloginhandler, string s, string s1) { if (bannedPlayers.contains(s.Trim().ToLower())) { netloginhandler.kickUser("You are banned from this server!"); return null; } if (!isAllowedToLogin(s)) { netloginhandler.kickUser("You are not white-listed on this server!"); return null; } string s2 = netloginhandler.netManager.getRemoteAddress().toString(); s2 = s2.Substring(s2.IndexOf("/") + 1); s2 = s2.Substring(0, s2.IndexOf(":")); if (bannedIPs.contains(s2)) { netloginhandler.kickUser("Your IP address is banned from this server!"); return null; } if (playerEntities.size() >= maxPlayers) { netloginhandler.kickUser("The server is full!"); return null; } for (int i = 0; i < playerEntities.size(); i++) { var entityplayermp = (EntityPlayerMP) playerEntities.get(i); if (entityplayermp.username.ToLowerInvariant() == s.ToLowerInvariant()) { entityplayermp.playerNetServerHandler.kickPlayer("You logged in from another location"); } } return new EntityPlayerMP(mcServer, mcServer.worldMngr, s, new ItemInWorldManager(mcServer.worldMngr)); }