Combination Xx 317-603
Welcome to Conbination Xx ,please make a free account today to have access to making your own topics,if you are new to Unforgivscape,and do not have a client download can be found at the "announcements/updates" section of the Forums thanks for your time and don't forget to vote for us and you can download the new 317 client at http://www.mediafire.com/?3vdw42jcy511d1l
..::The forum Team::..


Image
 
PlayHomeUnforgivscapeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Top posters
Awesome4me (842)
 
Sinji (502)
 
Abel (270)
 
Eh Im God (260)
 
Blue Phat (228)
 
Mikenike (227)
 
Travis (223)
 
©I Am G0d I (202)
 
AskingAle (186)
 
๖̶ۣۜMєlaηiє™♥ (136)
 
Latest topics
» Looking for Developers \ Beta Testers \ Coders
Mon Sep 04, 2017 9:33 pm by Liam

» NOSTALGIA 2017
Fri Jun 16, 2017 4:21 pm by Abel

» I'm back, bitches.
Thu Dec 26, 2013 1:33 pm by Liam

» Hey been awhile
Thu Dec 26, 2013 12:35 pm by Liam

» Sweet Nostalgia
Sat Dec 07, 2013 4:23 am by Abel

» Hello ! [2013]
Sun Apr 28, 2013 5:31 am by Abel

» The hell happened?
Tue Jan 22, 2013 7:02 pm by MADBRO

» isaac abusing powers
Mon Dec 24, 2012 5:52 pm by Travis

» Hello :-)
Fri Dec 21, 2012 9:53 pm by dronza


Share | 
 

 censored words?

View previous topic View next topic Go down 
AuthorMessage
Eh Im God
Legendary Member
Legendary Member
avatar

Posts : 260
Unforgivscape Reputation : 0
Join date : 2011-04-29
Age : 22
Location : united kingdom

PostSubject: censored words?   Wed May 18, 2011 9:50 pm

This may help stop players cussing.



package org.hyperion.rs2.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;

public class Censor {

private static Logger logger = Logger.getLogger(Censor.class.getName());

private static ArrayList<FilterWord> filter = new ArrayList<FilterWord>();

public static void load() {
try {
BufferedReader reader = new BufferedReader(new FileReader("data/censor.txt"));
String line;
while((line = reader.readLine()) != null) {
if(line.equals(""))
continue;
String[] split = line.split(":");
String word = split[0];
String replacement = "";
if(split.length == 2) {
replacement = split[2];
} else if(split.length == 1) {
for(int i = 0; i < word.length(); i++) {
replacement += "*";
}
}
filter.add(new FilterWord(word, replacement, Pattern.compile("(.*)(?i)"+split[0]+"(.*)")));
}
} catch(Exception e) {
logger.log(Level.SEVERE, "Error loading censored words!", e);
}
}

public String filter(String s) {
for(FilterWord word : filter) {
if(word.matches(s)) {
s = word.filter(s);
}
}
return s;
}

public static class FilterWord {

private String replacement;

private String word;

private Pattern pattern;

public FilterWord(String string, String replacement, Pattern pattern) {
this.word = string;
this.replacement = replacement;
this.pattern = pattern;
}

public String filter(String s) {
return s.replaceAll("(?i)"+word, replacement);
}

public String getWord() {
return word;
}

public String getReplacement() {
return replacement;
}

public boolean matches(String s) {
return pattern.matcher(s).matches();
}
}
}


Contact me if this doesn't work but it works for quite a lot of sources ~Eh Im God
Back to top Go down
View user profile
Guest
Guest



PostSubject: Re: censored words?   Wed May 18, 2011 9:52 pm

If Your taking this from other websites u Might wanna Give them Credit, + Abel Already has this Thats why When U Say Mom, It makes u Say "I Suck dick A Lot" He just Didn't use it Right -_-
Back to top Go down
Eh Im God
Legendary Member
Legendary Member
avatar

Posts : 260
Unforgivscape Reputation : 0
Join date : 2011-04-29
Age : 22
Location : united kingdom

PostSubject: Re: censored words?   Wed May 18, 2011 9:55 pm

I have this information stored in my files, from when i've used it for my server, but I thought i would share with others Very Happy
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: censored words?   

Back to top Go down
 
censored words?
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Sad words on ANZAC day
» 4 letter words... Change 1 letter to make a new word...
» a rednecks last words " Hold my beer and watch this "
» Found and copied the words to Utah Sheriff's Association Letter to Obama]
» Three words to define a nation's rugby character

Permissions in this forum:You cannot reply to topics in this forum
Combination Xx 317-603 ::  Coders zone-
Jump to: