Code: Select all
[javac] C:\ec\source\l2j\L2_GameServer\java\net\sf\l2j\gameserver\network\clientpackets\Say2.java:229: cannot find symbol [javac] symbol : method setInJail(boolean,int) [javac] location: class net.sf.l2j.gameserver.model.actor.instance.L2PcInstance [javac] activeChar.setInJail(true, punishmentLength); [javac] ^ [javac] 1 error
Code: Select all
Index: C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/chatfilter.txt===================================================================--- C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/chatfilter.txt (revision 0)+++ C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/chatfilter.txt (revision 0)@@ -0,0 +1,3 @@+noob+nub+n00b\ No newline at end of fileIndex: C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/l2jmods.properties===================================================================--- C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/l2jmods.properties (revision 2410)+++ C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/config/l2jmods.properties (working copy)@@ -161,4 +161,18 @@ #---------------------------------- EnableWarehouseSortingClan = False EnableWarehouseSortingPrivate = False-EnableWarehouseSortingFreight = False\ No newline at end of file+EnableWarehouseSortingFreight = False++#---------------------------------------------------------------+# Chat Filtering -+#--------------------------------------------------------------- +# To enable chat filter set this value to true, default is false.+UseChatFilter = False+# Replace illegal words with following chars+ChatFilterChars = ***+# Player punishment for illegal word: off, jail+ChatFilterPunishment = off+# How long the punishment is in effect, in minutes+ChatFilterPunishmentParam1 = 1+# How much to increase every new punishment for player, in minutes+ChatFilterPunishmentParam2 = 1\ No newline at end of fileIndex: C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/Config.java===================================================================--- C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/Config.java (revision 2410)+++ C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/Config.java (working copy)@@ -14,9 +14,11 @@ */ package net.sf.l2j; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream;+import java.io.FileReader; import java.io.InputStream; import java.io.OutputStream; import java.math.BigInteger;@@ -25,6 +27,7 @@ import java.util.Map; import java.util.Properties; import java.util.logging.Logger;+import java.io.LineNumberReader; import javolution.util.FastList; import javolution.util.FastMap;@@ -79,6 +82,8 @@ public static final String SIEGE_CONFIGURATION_FILE = "./config/siege.properties"; /** Properties file for telnet configuration */ public static final String TELNET_FILE = "./config/telnet.properties";+ /** Word list for chat filter */+ public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt"; /******************************************************************************************************************************************************/ /** L2J Property File Definitions End Here**/@@ -527,6 +532,13 @@ public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_CLAN; public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE; public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;+ // Chat filter+ public static boolean USE_CHAT_FILTER;+ public static ArrayList<String> FILTER_LIST = new ArrayList<String>();+ public static String CHAT_FILTER_CHARS;+ public static String CHAT_FILTER_PUNISHMENT;+ public static int CHAT_FILTER_PUNISHMENT_PARAM1;+ public static int CHAT_FILTER_PUNISHMENT_PARAM2; /** ************************************************** **/ /** L2JMods Settings -End **/@@ -1754,6 +1766,33 @@ BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false")); BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1")); BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));+ USE_CHAT_FILTER = Boolean.parseBoolean(L2JModSettings.getProperty("UseChatFilter", "False")); + CHAT_FILTER_CHARS = L2JModSettings.getProperty("ChatFilterChars", "***");+ CHAT_FILTER_PUNISHMENT = L2JModSettings.getProperty("ChatFilterPunishment", "off");+ CHAT_FILTER_PUNISHMENT_PARAM1 = Integer.parseInt(L2JModSettings.getProperty("ChatFilterPunishmentParam1", "1")); + CHAT_FILTER_PUNISHMENT_PARAM2 = Integer.parseInt(L2JModSettings.getProperty("ChatFilterPunishmentParam2", "1")); + if (USE_CHAT_FILTER)+ {+ try+ {+ LineNumberReader lnr = new LineNumberReader(new BufferedReader(new FileReader(new File(CHAT_FILTER_FILE))));+ String line = null;+ while ((line = lnr.readLine()) != null)+ {+ if (line.trim().length() == 0 || line.startsWith("#"))+ {+ continue;+ }+ FILTER_LIST.add(line.trim());+ }+ _log.info("Chat Filter: Loaded " + FILTER_LIST.size() + " words");+ }+ catch (Exception e)+ {+ e.printStackTrace();+ throw new Error("Failed to Load "+CHAT_FILTER_FILE+" File.");+ }+ } } catch (Exception e) {Index: C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java===================================================================--- C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 2410)+++ C:/Documents and Settings/Administrator/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (working copy)@@ -14,12 +14,16 @@ */ package net.sf.l2j.gameserver.network.clientpackets; +import java.sql.PreparedStatement;+import java.sql.ResultSet;+import java.sql.SQLException; import java.nio.BufferUnderflowException; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; import net.sf.l2j.Config;+import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.handler.ChatHandler; import net.sf.l2j.gameserver.handler.IChatHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;@@ -151,6 +155,71 @@ _logChat.log(record); } + if (Config.USE_CHAT_FILTER && (_type == ALL ||_type == SHOUT ||_type == TRADE ||_type == HERO_VOICE))+ {+ String filteredText = _text;+ + for (String pattern : Config.FILTER_LIST)+ {+ filteredText = filteredText.replaceAll(pattern, Config.CHAT_FILTER_CHARS);+ }+ + if (Config.CHAT_FILTER_PUNISHMENT.equalsIgnoreCase("jail") && _text != filteredText)+ {+ int punishmentLength = 0;+ if (Config.CHAT_FILTER_PUNISHMENT_PARAM2 == 0)+ {+ punishmentLength = Config.CHAT_FILTER_PUNISHMENT_PARAM1;+ }+ else+ {+ java.sql.Connection con = null;+ try+ {+ con = L2DatabaseFactory.getInstance().getConnection();+ PreparedStatement statement;+ + statement = con.prepareStatement("SELECT value FROM account_data WHERE (account_name=?) AND (var='jail_time')");+ statement.setString(1, activeChar.getAccountName());+ ResultSet rset = statement.executeQuery();+ + if (!rset.next())+ {+ punishmentLength = Config.CHAT_FILTER_PUNISHMENT_PARAM1;+ PreparedStatement statement1;+ statement1 = con.prepareStatement("INSERT INTO account_data (account_name, var, value) VALUES (?, 'jail_time', ?)");+ statement1.setString(1, activeChar.getAccountName());+ statement1.setInt(2, punishmentLength);+ statement1.executeUpdate();+ statement1.close();+ }+ else+ {+ punishmentLength = rset.getInt("value") + Config.CHAT_FILTER_PUNISHMENT_PARAM2;+ PreparedStatement statement1;+ statement1 = con.prepareStatement("UPDATE account_data SET value=? WHERE (account_name=?) AND (var='jail_time')");+ statement1.setInt(1, punishmentLength);+ statement1.setString(2, activeChar.getAccountName());+ statement1.executeUpdate();+ statement1.close();+ }+ rset.close();+ statement.close();+ }+ catch (SQLException e)+ {+ _log.warning("Could not check character for chat filter punishment data: " + e);+ }+ finally+ {+ try { con.close(); } catch (Exception e) {}+ }+ }+ activeChar.setInJail(true, punishmentLength);+ }+ _text = filteredText;+ }+ IChatHandler handler = ChatHandler.getInstance().getChatHandler(_type); if (handler != null) {