Thread: Word censor

Page 1 of 15 12311 ... LastLast
Results 1 to 10 of 142
  1. #1 Word censor 
    Registered Member

    Join Date
    Sep 2008
    Posts
    1,801
    Thanks given
    4
    Thanks received
    50
    Rep Power
    636
    Description - Adding a proper Word censor

    Difficulty - 2/10, have no clue how hard this could be

    files added/modified - PublicChat.java, Engine.java, Censor.java

    well i was bored and decided to make this, even though i wouldn't put it in a server
    this took about 5 min.

    Step 1:
    Create a new file in the utils folder called "Censor.java"
    In that file paste this,
    Code:
    package ZabboScape.util;
    
    import java.io.*;
    import java.util.ArrayList;
    import java.util.List;
    
    public class Censor {
    
        public static List<String> censored = new ArrayList<String>();
    
        public Censor() {
    	loadWords();
        }
    
        private void loadWords() {
            String word = null;
            try {
                BufferedReader in = new BufferedReader(new FileReader("./data/Censor.txt"));
                while ((word = in.readLine()) != null) {
                    censored.add(word);
                }
                in.close();
                in = null;
            } catch (Exception e) {
                Misc.println("Error load the censor.");
            }
        }
    
    }
    Save and close
    Step 2:
    Open up Engine.java and paste this in there
    Code:
        /*Word censor*/
        public static Censor Censor = new Censor();
    Step 3:
    Open up public chat and add this under p.chatText = Misc.decryptPlayerChat(p.stream, numChars);
    Code:
    	for (String s : Engine.Censor.censored) {
    	    if (p.chatText.contains(s)) {
    		int length = s.length();
    		String replace = "";
    		for(int i = 0; i < length; i++) {
    		    replace += "*";
    		}
    		p.chatText = p.chatText.replaceAll(s, replace);
    	    }
    	}
    Save and close
    Step 4:
    go to your data folder and create a file called Censor (make sure its a text file)
    and add all the words you want to be censored into it

    Post any errors are ask any questions and i'll do my best to help you
     

  2. #2  
    Banned

    Join Date
    Jan 2008
    Posts
    1,778
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    Ohhh very nice , and better cuz it loads from a file
     

  3. #3  
    Registered Member

    Join Date
    Sep 2008
    Posts
    1,801
    Thanks given
    4
    Thanks received
    50
    Rep Power
    636
    thanks =D
     

  4. #4  
    Registered Member
    Santaher0's Avatar
    Join Date
    Sep 2008
    Posts
    2,033
    Thanks given
    324
    Thanks received
    49
    Rep Power
    1282
    nice not gonna use tough I like it if you can say fuck otherwise there's no reaso to mute someone
    - Support my project ArkScape

    - Santaher0's MusicBot

    - Santaher0's MovieBot
     

  5. #5  
    Registered Member

    Join Date
    Sep 2008
    Posts
    1,801
    Thanks given
    4
    Thanks received
    50
    Rep Power
    636
    yep, i have it as a punishment like muting but at a smaller scale
     

  6. #6  
    Community Veteran


    Join Date
    Dec 2008
    Posts
    4,263
    Thanks given
    405
    Thanks received
    436
    Rep Power
    1674
    this dont work i get error loading censor
     

  7. #7  
    Registered Member

    Join Date
    Sep 2008
    Posts
    1,801
    Thanks given
    4
    Thanks received
    50
    Rep Power
    636
    it works otherwise i wouldn't of post it
    Make sure you made the file named exactly as i posted it and make sure its a TEXT file
    seperate all words by enters
     

  8. #8  
    Registered Member SilentZPrO's Avatar
    Join Date
    Dec 2008
    Posts
    727
    Thanks given
    3
    Thanks received
    4
    Rep Power
    12
    I have this:
    Compiling palidino76.rs2
    .\palidino76\rs2\Engine.java:31: cannot find symbol
    symbol : class Censor
    location: class palidino76.rs2.Engine
    public static Censor Censor = new Censor();
    ^
    .\palidino76\rs2\Engine.java:31: cannot find symbol
    symbol : class Censor
    location: class palidino76.rs2.Engine
    public static Censor Censor = new Censor();
    ^
    .\palidino76\rs2\io\packets\PublicChat.java:33: package Engine does not exist
    for (String s : Engine.Censor.censored) {
    ^
    3 errors
    Press any key to continue . . .

     

  9. #9  
    Registered Member

    Join Date
    Sep 2008
    Posts
    1,801
    Thanks given
    4
    Thanks received
    50
    Rep Power
    636
    add this at the very top of PublicChat
    Code:
    import palidino76.rs2.Engine;


    ---------- Post added at 03:43 PM ---------- Previous post was at 03:42 PM ----------

    Quote Originally Posted by shassan View Post
    idk
    do what i said ^ but then for the other error open Censor.java
    and make sure you got
    Code:
    import java.io.*;
    at the top or close to the top
     

  10. #10  
    Registered Member
    Rewind's Avatar
    Join Date
    Jan 2009
    Posts
    608
    Thanks given
    0
    Thanks received
    0
    Rep Power
    80
    Silentz pro nice avatar lol, and thanks for this
     

Page 1 of 15 12311 ... 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
  •