1 package net.sourceforge.simplegamenet.framework.model;
2
3 import java.io.Serializable;
4 import java.util.regex.Pattern;
5
6 public class ChatMessage implements Serializable {
7
8 public static final int SYSTEM_MESSAGE = 0;
9 public static final int GAME_MESSAGE = 1;
10 public static final int PLAYER_MESSAGE = 100;
11 public static final int PLAYER_EMOTE = 101;
12
13 private static final String[] badLanguageList
14 = {
15 "asshole", "bitch", "blowjob", "cock", "dick", "fack", "faggot", "fuck", "nigga",
16 "nigger", "shit", "slut", "whore",
17 "connard", "nique", "putain",
18 "scheisse",
19 "klootzak"
20 };
21
22 public static String filterString(String string) {
23 for (int i = 0; i < badLanguageList.length; i++) {
24 string = Pattern.compile(badLanguageList[i],
25 Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)
26 .matcher(string).replaceAll("#*%!");
27 }
28 return string;
29 }
30
31 private int type;
32 private Integer playerID;
33 private String message;
34
35 public ChatMessage(int type, String message) {
36 this(type, message, null);
37 }
38
39 public ChatMessage(int type, String message, Integer playerID) {
40 this.type = type;
41 this.message = message;
42 this.playerID = playerID;
43 }
44
45 public int getType() {
46 return type;
47 }
48
49 public String getMessage() {
50 return message;
51 }
52
53 public void setMessage(String message) {
54 this.message = message;
55 }
56
57 public Integer getPlayerID() {
58 return playerID;
59 }
60
61 }