Purpose: To stop the noobs that crash servers for fun.
Difficulty: 1/10 (took me 2 days to make :mad: because i dont have that much free time)
Assumed Knowledge: how to open up your java files and compile it.
Server Base: Any (post if yours does not work)
Classes Modified: server.java
Procedure
Step 1:
Find " if (Found < 3) { " and under it delete
playerHandler.newPlayerClient(s, connectingHost);
Step 2:
Add this code to your server.java file under " if (Found < 3) { ".
//multi login code
for(int z = 0; z < Foundz; z++) {
int y = z+1;
if(connectingHost.startsWith(Connections[y]+"") ){//Connected
misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
s.close(); //close port
break;
}else{
if(z < Foundz){ //at the end of the for loop run this
Foundz++;//adds 1 for next player
z++; //adds1 to save string to next aray
Connections[z] = connectingHost;
System.out.println("ClientHandler: Accepted Connection Fully");
playerHandler.newPlayerClient(s, connectingHost); //logs player in
break; //ends for loop
}
}
}
Step 3:
Add this int to your file.
public static int Foundz = 1;
public static int resetplayz;
Step 4:
Under "if(updateServer)" add
if(resetplayz >= 30){ // resets the players that logged in about ever 15 secconds
for(int i = 0; i < 300; i++) { //run about 300 times i dont think we are going to get 300 connections in 15 secconds
Connections = null;// reset
}
resetplayz = 0;
}else{
resetplayz++;
}