Jump to content

Recommended Posts

Posted

Chat filter system, with a log to write the words you don't allow in your server.

 

Index: /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java
===================================================================
--- /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 12)
+++ /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 130)
@@ -192,4 +192,48 @@

			_logChat.log(record);
+		}
+		
+		if (L2Config.USE_CHAT_FILTER)
+		{            
+            if (_type == SHOUT || _type == TRADE || _type == HERO_VOICE)
+            {
+            	String filteredText = _text;
+            	filteredText = filteredText.replace("=", "");
+        		filteredText = filteredText.replace("*", "");
+        		filteredText = filteredText.replace(" ", "");
+        		filteredText = filteredText.replace("-", "");
+        		filteredText = filteredText.replace("_", "");
+        		filteredText = filteredText.replace(".", "");
+        		filteredText = filteredText.replace(",", "");
+    			filteredText = filteredText.replace("'", "");
+    			filteredText = filteredText.replace("/", "");
+    			filteredText = filteredText.replace("+", "");
+    			filteredText = filteredText.toLowerCase();
+            	if(!activeChar.inObserverMode() && !activeChar.isInDuel() && !activeChar.isInOlympiadMode() 
+            			&& L2Config.CHAT_FILTER_PUNISHMENT.equalsIgnoreCase("jail") && !activeChar.isInCombat()) {
+	    			for (int i = 0; i < L2Config.FILTER_LIST.size(); i++)
+	    			{
+	    				if(filteredText.contains(L2Config.FILTER_LIST.get(i).toString())) {
+	    					int punishmentLength = 0;                
+	    					punishmentLength = L2Config.CHAT_FILTER_PUNISHMENT_PARAM1 + (L2Config.CHAT_FILTER_PUNISHMENT_PARAM2*activeChar.ChatFilterCount);                
+	    					activeChar.sendMessage("[ChatFilterSystem] Be careful whith words"); 
+	    					activeChar.sendMessage("[ChatFilterSystem] Word " + L2Config.FILTER_LIST.get(i).toString()+ " is untolerable");
+	    					activeChar.setInJail(true, punishmentLength);
+	    					activeChar.ChatFilterCount += 1;
+	    					_text = "[CFS] Jailed for " + punishmentLength + "mins";
+	    					break;
+	    				}
+	    			}
+            	} else {
+	    			for (int i = 0; i < L2Config.FILTER_LIST.size(); i++)
+	    			{
+	    				if(filteredText.contains(L2Config.FILTER_LIST.get(i).toString())) {
+	    					activeChar.sendMessage("[ChatFilterSystem] Be careful whith words");
+	    					activeChar.sendMessage("[ChatFilterSystem] Word " + L2Config.FILTER_LIST.get(i).toString()+ " is untolerable");
+	    					_text = "[CFS] Text cleared";
+	    				}
+	    			}
+            	}
+            }
		}
        
Index: /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 105)
+++ /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 130)
@@ -216,6 +216,6 @@
	private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";

-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,chat_filter_count=? WHERE obj_id=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,chat_filter_count FROM characters WHERE obj_id=?";
    private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
    private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
@@ -5910,5 +5910,6 @@

                player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
-
+                player.setChatFilterCount(rset.getInt("chat_filter_count"));
+                
				// Add the L2PcInstance object in _allObjects
				//L2World.getInstance().storeObject(player);
@@ -6274,5 +6275,6 @@
			statement.setString(55, getName());
			statement.setLong(56, getDeathPenaltyBuffLevel());
-            statement.setInt(57, getObjectId());
+			statement.setInt(57, getChatFilterCount());
+            statement.setInt(58, getObjectId());

			statement.execute();
@@ -6393,5 +6395,16 @@
		finally { try { con.close(); } catch (Exception e) {} }
	}
-
+   
+	/** ChatFilterCounter */
+	public int ChatFilterCount = 0;
+	
+	public void setChatFilterCount(int cfcount)
+	{
+		ChatFilterCount = cfcount;
+	}
+	public int getChatFilterCount()
+	{
+		return ChatFilterCount;
+	}
	/**
	 * Return True if the L2PcInstance is on line.<BR><BR>
Index: /trunk/Eclipse-Game/java/net/sf/l2j/L2Config.java
===================================================================
--- /trunk/Eclipse-Game/java/net/sf/l2j/L2Config.java (revision 128)
+++ /trunk/Eclipse-Game/java/net/sf/l2j/L2Config.java (revision 130)
@@ -6,4 +6,7 @@
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.LineNumberReader;
+import java.io.BufferedReader;
+import java.io.FileReader;
import java.math.BigInteger;
import java.util.List;
@@ -60,4 +63,5 @@
    public static final String  DATAPACK_VERSION_FILE         = "./config/l2jdp-version.properties";
    public static final String  LOGIN_CONFIGURATION_FILE      = "./config/loginserver.properties";
+    public static final String  CHAT_FILTER_FILE              = "./config/ChatFilter.txt";
    public static int   MAX_ITEM_IN_PACKET;

@@ -770,6 +774,10 @@
	public static final FloodProtectorConfig FLOOD_PROTECTOR_WEREHOUSE = new FloodProtectorConfig("WerehouseFloodProtector");
    public static final FloodProtectorConfig FLOOD_PROTECTOR_MISC = new FloodProtectorConfig("MiscFloodProtector");
-	public static final FloodProtectorConfig FLOOD_PROTECTOR_CHAT = new FloodProtectorConfig("ChatFloodProtector");
-
+	public static final FloodProtectorConfig FLOOD_PROTECTOR_CHAT = new FloodProtectorConfig("ChatFloodProtector");  
+    public static boolean	USE_CHAT_FILTER;
+    public static List<String> FILTER_LIST = new FastList<String>();
+    public static String	CHAT_FILTER_PUNISHMENT;
+    public static int	CHAT_FILTER_PUNISHMENT_PARAM1;
+    public static int	CHAT_FILTER_PUNISHMENT_PARAM2;
    
    // Class Balance 
@@ -2100,4 +2108,33 @@
                floodprotectorSettings.load(is);
                is.close();
+                
+                USE_CHAT_FILTER                  = Boolean.parseBoolean(floodprotectorSettings.getProperty("UseChatFilter", "True"));
+                CHAT_FILTER_PUNISHMENT           = floodprotectorSettings.getProperty("ChatFilterPunishment", "off");
+                CHAT_FILTER_PUNISHMENT_PARAM1    = Integer.parseInt(floodprotectorSettings.getProperty("ChatFilterPunishmentParam1", "1")); 
+                CHAT_FILTER_PUNISHMENT_PARAM2    = Integer.parseInt(floodprotectorSettings.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.");
+                    }
+                }
+                
                loadFloodProtectorConfigs(floodprotectorSettings);
                _log.info("# " + FLOODPROTECTOR_CONFIG_FILE + " Sucessfully LOADED #");
Index: /trunk/Eclipse-Game/config/ChatFilter.txt
===================================================================
--- /trunk/Eclipse-Game/config/ChatFilter.txt (revision 130)
+++ /trunk/Eclipse-Game/config/ChatFilter.txt (revision 130)
@@ -0,0 +1,7 @@
+lag
+laag
+laaag
+laaaag
+laaaaag
+laaaaaag
+laaaaaaag
Index: /trunk/Eclipse-Game/config/Custom/FloodProtector.properties
===================================================================
--- /trunk/Eclipse-Game/config/Custom/FloodProtector.properties (revision 76)
+++ /trunk/Eclipse-Game/config/Custom/FloodProtector.properties (revision 130)
@@ -7,4 +7,16 @@
# PunishmentType - type of the punishment ('none', 'ban', 'jail'), used only, if PunishmentLimit is greater than zero
# PunishmentTime - for how many minutes should be the player/account punished, player is punished in case of 'jail', account is punishedin case of 'ban' (0 = forever)
+
+#---------------------------------------------------------------
+# Chat Filter system                                           -
+#---------------------------------------------------------------
+# Enable chat filter
+UseChatFilter = False
+# Player punishment for illegal word: off, jail
+ChatFilterPunishment = off
+# How long the punishment is in effect, min
+ChatFilterPunishmentParam1 = 10
+# How much to increase every new punishment for player, min
+ChatFilterPunishmentParam2 = 5

FloodProtectorUseItemInterval = 4

 

Credits: one guy from L2JForum, and ŚyśţęmƒяәдҚς for some modifications, nothing special, just removal effect.

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Hi guys, this is a CMS im sharing for lineage 2 servers, im tired of the crap i see on new release servers. Dont let me start on the IA developed ones lmao.   📋 Description Free and open source template to create landing pages for Lineage 2 private servers. Designed with a dark fantasy theme and modern animations. ✨ Current Features This FREE version includes: Complete Landing Page - Professional design ready to use Multi-language Support - Spanish, English, Portuguese Dark Fantasy Theme - With animated UI elements Server Information - Rates, features, and rules Olympiad Ranking - Rankings display Download Section - For game client Skins and Animations Gallery Streaming Widget - Twitch/Kick integration Fully Customizable - Via configuration files ❌ Not Included in Free Version ❌ User Registration System ❌ Online Players Counter ❌ Donation Panel 💎 Premium Integrations IntegrationPrice Registration System $50 USD Online Players Counter $50 USD Donation Panel $50 USD   📧 Contact: https://gh0tstudio.com 🛠️ Tech Stack Technology    Version    Description React              19.2.0       UI Library TypeScript       5.8.2        Static typing Vite                 6.2.0         Build tool TailwindCSS   CDNCSS    Framework Lucide React   0.554.0         Icons i18next           23.16.0       Internationalization react-i18next   15.1.0        React bindings for i18n All documentation provided for AI AGENTS to make changes on the ui texts and so on. u can have a look on the cms fully working with donation panel, online count and register via: https://crmlineage2.vercel.app/ https://github.com/6h0T/CRM-LINEAGE2-FREE If u are in the lookings to develop a unique website for ur projects, u can dm me or contact me throw my socials on my profile. all code has encrypted references so any type of rebranding, copying or selling without authorization will result in take downs
    • Hello dude, i can help u out, i reached to u via DM, my studio is https://gh0tstudio.com i have worked with almost 40 brands on developing Private Lineage and Mu online servers, dashboard for vote pages and more. I sent u some examples too
    • L2 TARTARUS - HTML DESIGN       L2 KOMBAT - ANIMATED BORDER   L2 SERENITY - ANIMATED LOGO   L2 ARCANE - COMMUNITY BOARD     L2 AMERIKA - ADVERTISING BANNER   L2 ZERON - ADVERTISING BANNER  
    • SOCNET — 生日快乐! 感谢您一直陪伴我们! 为期一周的礼物、奖励和折扣盛宴! 今天我们庆祝SOCNET项目的生日——而礼物属于您! 我们为所有服务准备了超强优惠: ⭐ SOCNET STORE — 商店 (网站/Telegram) 1. 优惠码BIRTHDAY — 20%折扣 可用于购买任何商品! 2. 大额购买礼品 在任意商品上消费$200,即可任选一件价值不超过$10的商品——免费赠送! 3. 在我们商店主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐ SOCNET SMM 面板 1. 充值 = 奖励 充值$100并获得+$5余额。 充值后请在面板内创建工单。 2. 在我们的 SMM 面板主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐SOCNET STARS — Telegram Stars/Premium 购买机器人 1. 大额购买 = 巨额奖励 单笔购买>1000 Stars,即可获赠+100 Stars! 购买后请联系支持。 2. 在我们 Stars 购买机器人的主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 发表评论: ➡ 1个论坛 = +50 Stars余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐SOCNET SMS 虚拟号码服务 1. 充值赠送奖励 充值$50即可获赠+$10。 充值后只需联系支持即可。 2. 在我们的 SMS 服务主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 让我们一起庆祝吧! 活动有效期为2025年12月02日至12月07日(含)。 不要错过——这是全年最优惠的条件! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式 & 支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • SOCNET — 生日快乐! 感谢您一直陪伴我们! 为期一周的礼物、奖励和折扣盛宴! 今天我们庆祝SOCNET项目的生日——而礼物属于您! 我们为所有服务准备了超强优惠: ⭐ SOCNET STORE — 商店 (网站/Telegram) 1. 优惠码BIRTHDAY — 20%折扣 可用于购买任何商品! 2. 大额购买礼品 在任意商品上消费$200,即可任选一件价值不超过$10的商品——免费赠送! 3. 在我们商店主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐ SOCNET SMM 面板 1. 充值 = 奖励 充值$100并获得+$5余额。 充值后请在面板内创建工单。 2. 在我们的 SMM 面板主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐SOCNET STARS — Telegram Stars/Premium 购买机器人 1. 大额购买 = 巨额奖励 单笔购买>1000 Stars,即可获赠+100 Stars! 购买后请联系支持。 2. 在我们 Stars 购买机器人的主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 发表评论: ➡ 1个论坛 = +50 Stars余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 ⭐SOCNET SMS 虚拟号码服务 1. 充值赠送奖励 充值$50即可获赠+$10。 充值后只需联系支持即可。 2. 在我们的 SMS 服务主题帖中发表评论可获赠余额 "Happy Birthday, SOCNET. My username/email is":BHW、BFD、voided、nulled 和 patched 论坛。 ➡ 1个论坛 = $1余额! 通过下方提供的联系方式将帖子截图发送给客服,附上您的登录名/邮箱,即可领取奖励。 让我们一起庆祝吧! 活动有效期为2025年12月02日至12月07日(含)。 不要错过——这是全年最优惠的条件! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式 & 支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock