Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Limitar mensajes del chat con tiempo

Iniciado por Swarlog, Sep 01, 2022, 12:51 AM

Tema anterior - Siguiente tema

Swarlog

Index: java/config/options.properties
===================================================================
#[False] Does not necessarily imply that the GeoData buffer's content is not resident in physical memory.
ForceGeodata = True
+
+#True = Enable delay
+ShoutChatDelay = False
+TradeChatDelay = False

Index: java/net/sf/l2j/Config.java
===================================================================
    /** AI max thread */
    public static int AI_MAX_THREAD;
+
+    public static boolean SHOUT_CHAT_DELAY;
+    public static boolean TRADE_CHAT_DELAY;
+
... ...   
                FORCE_GEODATA                   = Boolean.parseBoolean(optionsSettings.getProperty("ForceGeoData", "True"));
                ACCEPT_GEOEDITOR_CONN           = Boolean.parseBoolean(optionsSettings.getProperty("AcceptGeoeditorConn", "False"));
+
+                SHOUT_CHAT_DELAY                  = Boolean.parseBoolean(optionsSettings.getProperty("ShoutChatDelay", "false"));
+                TRADE_CHAT_DELAY                  = Boolean.parseBoolean(optionsSettings.getProperty("TradeChatDelay", "false"));

Index: java/net/sf/l2j/Config.java
===================================================================
    /** AI max thread */
    public static int AI_MAX_THREAD;
+
+    public static boolean SHOUT_CHAT_DELAY;
+    public static boolean TRADE_CHAT_DELAY;
+
... ...   
                FORCE_GEODATA                   = Boolean.parseBoolean(optionsSettings.getProperty("ForceGeoData", "True"));
                ACCEPT_GEOEDITOR_CONN           = Boolean.parseBoolean(optionsSettings.getProperty("AcceptGeoeditorConn", "False"));
+
+                SHOUT_CHAT_DELAY                  = Boolean.parseBoolean(optionsSettings.getProperty("ShoutChatDelay", "false"));
+                TRADE_CHAT_DELAY                  = Boolean.parseBoolean(optionsSettings.getProperty("TradeChatDelay", "false"));

Index: java/net/sf/l2j/gameserver/clientpackets/Say2.java
===================================================================
case SHOUT:
+   if (Config.SHOUT_CHAT_DELAY && !activeChar.isGM())
+ {
+ if (!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_SHOUTVOICE))
+ {
+ activeChar.sendMessage("Action failed. You are only able to speak in the Shout channel once every 10 seconds.");
+ return;
+ }
+ }
                if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") ||
                        (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
... ...   
case TRADE:
+   if (Config.TRADE_CHAT_DELAY && !activeChar.isGM())
+ {
+ if (!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_TRADEVOICE))
+ {
+ activeChar.sendMessage("Action failed. You are only able to speak in the Trade channel once every 10 seconds.");
+ return;
+ }
+ }
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") ||
(Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))

Index: java/net/sf/l2j/gameserver/util/FloodProtector.java
===================================================================
         public static final int PROTECTED_ITEMPETSUMMON = 3;
         public static final int PROTECTED_HEROVOICE             = 4;
+         public static final int PROTECTED_SHOUTVOICE    = 5;
+         public static final int PROTECTED_TRADEVOICE    = 6;

         // =========================================================

config/options:

# Chat configuration
# Values: GLOBAL, REGION, GM, OFF
# Global Chat - Default: REGION
GlobalChat = REGION
# Time limit between using Global Chat in 100ms
GlobalChatTime = 1
# Trade Chat - Default: REGION
TradeChat = REGION
# Time limit between using Trade Chat in 100ms
TradeChatTime = 1