Thread: My Own Yell Command, with filter, logs and a lock command.

Page 1 of 6 123 ... LastLast
Results 1 to 10 of 51
  1. #1 My Own Yell Command, with filter, logs and a lock command. 
    Registered Member
    AndyJay's Avatar
    Join Date
    Jun 2008
    Posts
    1,285
    Thanks given
    38
    Thanks received
    48
    Rep Power
    84
    This tutorial also includes two other commands to lock/unlock yell.

    Purpose: If you get people spamming your ::yell command you can disable/enable yelling. You can also apply words to a filter which will block the yell. Also yells are recorded to a yells.txt file incase you need to review them
    Files modified: client.java, server.java
    Dificulty: Depends on your knowledge of java and copy and pasting skill

    Before we start, you may wish to backup your client and server.java incase anything major arrises.

    To start with, go into your logs folder and create a file named yells.txt
    Open up client.java and search for ("yell") Once you've found it, replace the whole command with the following:

    Code:
    if (command.startsWith("yell") && command.length() > 5){
    BufferedWriter yellBW = null;
    if(muted == 1) //Checks if the player is muted/not muted
    sendMessage("You are muted and cannot yell!");
    else if(server.lockyell == false) { //If yell isn't locked
    String text = command.substring(5);
    String[] bad = {"chalreq", "duelreq", "tradereq", "no-ip.biz", "no-ip.org", "servegame", ".com", ".net", ".org", "no-ip", "****", "is gay", "****", "crap", "rubbish",}; //Add more filtered words here.
    for(int i = 0; i < bad.length; i++){
    if(text.indexOf(bad[i]) >= 0){
    sendMessage("You are not allowed to say that on Yell!");
    return;
    }
    }
    PlayerHandler.messageToAll = playerName+ " - " +command.substring(5); //If the yell isn't filtered/locked etc.
    } else {
    sendMessage("The yell command is currently disabled"); //If yell is locked
    }
    try {
    yellBW = new BufferedWriter(new FileWriter("logs/yells.txt", true)); //You may need to edit this line to your yells.txt file location.
    yellBW.write(playerName+" yelled "+command.substring(5));
    yellBW.newLine();
    yellBW.write("-------------------------------------");
    yellBW.newLine();
    yellBW.flush();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    } finally {
    if (yellBW != null) try {
    yellBW.close();
    } catch (IOException ioe2) {
    sendMessage(" ");
    }
    }
    disconnected = false;
    }
    That's the new yell command which includes a filter, logs, muted and locked/unlocked check. Next you need to add the commands to lock and unlock yell. Under/above the yell command, or wherever you want to add it, add the two following commands.

    Code:
    if (command.equalsIgnoreCase("disableyell") && playerRights >= 2) {
    server.lockyell = true;
    PlayerHandler.messageToAll = "Administrator "+p.playerName+" Has temporally disabled yell";
    }
    if (command.equalsIgnoreCase("enableyell") && playerRights >= 2) {
    server.lockyell = false;
    PlayerHandler.messageToAll = "Yell Enabled.";
    }
    You may now save and close client.java
    Open up server.java

    Under where it says public class server implements Runnable { add this:
    Code:
    public static boolean lockyell;
    You may now save and close server.java. Your also finished with everything now. You shouldn't get any errors. If you do most will be able to be fixed with a bit of editing. Report any major errors & problems etc.

    This was created by me for my Server; If you see it anywhere else then it's leached - Let me know

    Credits: 100% AndyJay123
    Reply With Quote  
     

  2. #2  
    Registered Member
    [М]ęŋąċę©'s Avatar
    Join Date
    Apr 2008
    Posts
    409
    Thanks given
    8
    Thanks received
    2
    Rep Power
    133
    good job, might rip out the filter xD
    Quote Originally Posted by Downfall™ View Post
    roflz.this is kinda stupid.syis are just retarded cause all i do is send a trojan to who ever uses it lolz its not hard 2 figure out whos doing it
    Reply With Quote  
     

  3. #3  
    Registered Member
    AndyJay's Avatar
    Join Date
    Jun 2008
    Posts
    1,285
    Thanks given
    38
    Thanks received
    48
    Rep Power
    84
    Quote Originally Posted by michel202 View Post
    good job, might rip out the filter xD
    I like making stuff like this, nice and easy lol I have lock chat and trades and attack and stuff
    Reply With Quote  
     

  4. #4  
    Registered Member
    Mojave's Avatar
    Join Date
    Jul 2008
    Posts
    751
    Thanks given
    1
    Thanks received
    39
    Rep Power
    134
    i got 1 error an unclosed string literal.
    Reply With Quote  
     

  5. #5  
    Extreme Donator

    Patrity's Avatar
    Join Date
    Jul 2008
    Age
    28
    Posts
    937
    Thanks given
    173
    Thanks received
    306
    Discord
    View profile
    Rep Power
    882
    Quote Originally Posted by crying no mo View Post
    i got 1 error an unclosed string literal.
    theres a quotation mark missing somewhere. just look for it.
    Free map releases: [Only registered and activated users can see links. ]



    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Registered Member
    AndyJay's Avatar
    Join Date
    Jun 2008
    Posts
    1,285
    Thanks given
    38
    Thanks received
    48
    Rep Power
    84
    Quote Originally Posted by GraziServers View Post
    theres a quotation mark missing somewhere. just look for it.
    Is there? Works ok for me. Ill check it out thoug.
    Reply With Quote  
     

  7. #7  
    haloking
    Guest
    Quote Originally Posted by AndyJay123 View Post
    copy and pasting skill
    I laughed at that.

    I liked the command nice job on it, I never got the idea to add a filter to my yell command lol.
    Reply With Quote  
     

  8. #8  
    llamadudeee
    Guest
    Very nice,

    I'm going to try this.
    Reply With Quote  
     

  9. #9  
    Registered Member
    AndyJay's Avatar
    Join Date
    Jun 2008
    Posts
    1,285
    Thanks given
    38
    Thanks received
    48
    Rep Power
    84
    Quote Originally Posted by haloking View Post
    I laughed at that.

    I liked the command nice job on it, I never got the idea to add a filter to my yell command lol.
    Its good for when you get people spamming other IPs or whatever. Always works for me


    Quote Originally Posted by llamadudeee View Post
    Very nice,

    I'm going to try this.
    Let me know if you like!
    Reply With Quote  
     

  10. #10  
    Registered Member grimreper40's Avatar
    Join Date
    Sep 2008
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Very nice, I'm using this. Rep for you (been looking for something similar to this)

    ~Seth
    Reply With Quote  
     

Page 1 of 6 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •