This will automatically ban anyone who logs in with "mod" in their names or any other words you wish to block. You can configure the playerRights to make certain usergroups be allowed to have it in their names and what not.
Open up client.java (server-side) and search for:
Code:
public void initialize() {
Then directly under that add this:
Code:
String[] badNames = {"mod", "Mod", "admin", "Admin", "owner", "Owner"};//you can add more bad names here ,"example"
for(int i = 0; i < badNames.length; i++) {
if (playerName.contains(badNames[i]) && playerRights < 1 && playerRights > 3) {//this is where you would configure the playerRights
try {
Connection.addNameToBanList(playerName);
Connection.addNameToFile(playerName);
for(int j = 0; j < Config.MAX_PLAYERS; j++) {
if(Server.playerHandler.players[j] != null) {
if(Server.playerHandler.players[j].playerName.equalsIgnoreCase(playerName)) {
Server.playerHandler.players[j].disconnected = true;
Client c2 = (Client)Server.playerHandler.players[j];
}
}
}
} catch(Exception e) {
}
}
}
Basically all I did was copy the ban command lol, but this can still help people.
Also, my first snipplet
EDIT: Also I forgot to mention you must import this in client.java
Code:
import server.Connection;
Put it at the top with the rest of the imports.