Thread: [PI] Prevent users from having "mod" in their names

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 [PI] Prevent users from having "mod" in their names 
    Banned

    Join Date
    Oct 2009
    Posts
    734
    Thanks given
    168
    Thanks received
    54
    Rep Power
    0
    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.
    Reply With Quote  
     

  2. #2  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Feb 2010
    Posts
    1,203
    Thanks given
    178
    Thanks received
    173
    Rep Power
    0
    Nice job.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Oct 2009
    Posts
    734
    Thanks given
    168
    Thanks received
    54
    Rep Power
    0
    Quote Originally Posted by Harlan View Post
    Cool, I'm actually going to use that instead.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2011
    Posts
    537
    Thanks given
    25
    Thanks received
    35
    Rep Power
    0
    Code:
    src\server\model\players\Client.java:797: cannot find symbol
    symbol  : variable Connection
    location: class server.model.players.Client
                            Connection.addNameToBanList(playerName);
                            ^
    src\server\model\players\Client.java:798: cannot find symbol
    symbol  : variable Connection
    location: class server.model.players.Client
                            Connection.addNameToFile(playerName);
                            ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .
    I support Eliminate.


    [Today 06:28 PM] Scu11: Mans gotta spread his wings, to do his tings
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Aug 2011
    Posts
    27
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    import it.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jul 2011
    Posts
    537
    Thanks given
    25
    Thanks received
    35
    Rep Power
    0
    Quote Originally Posted by ownagekid View Post
    import it.
    i'm sorry but what do you mean by that?
    I support Eliminate.


    [Today 06:28 PM] Scu11: Mans gotta spread his wings, to do his tings
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Banned
    Join Date
    Aug 2011
    Posts
    27
    Thanks given
    0
    Thanks received
    1
    Rep Power
    0
    import server.Connection;
    Reply With Quote  
     

  10. #9  
    Banned

    Join Date
    May 2008
    Posts
    2,327
    Thanks given
    55
    Thanks received
    67
    Rep Power
    0
    or in login...

    playerName.replaceAll("mod", "fag");
    playerName.replaceAll("admin", "idiot");
    Reply With Quote  
     

  11. #10  
    Banned

    Join Date
    Mar 2011
    Posts
    4,062
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    ah nvm xD
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 19
    Last Post: 11-27-2010, 09:13 PM
  2. "hed","head","headicon" command like ::emote Rep++
    By «I Gf I» ©£ in forum Help
    Replies: 12
    Last Post: 10-06-2009, 05:30 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •