Noticias:

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

Menú Principal

Antifeed in Trade Chat

Iniciado por Swarlog, Ago 31, 2022, 08:05 PM

Tema anterior - Siguiente tema

Swarlog

Para que los usuarios solo puedan hablar cada 5 segundos.

Index: java/com/l2jserver/gameserver/util/FloodProtector.java ===================================================================
--- java/com/l2jserver/gameserver/util/FloodProtector.java
+++ java/com/l2jserver/gameserver/util/FloodProtector.java

@@ -50,7 +50,7 @@
// reuse delays for protected actions (in game ticks 1 tick = 100ms)
private static final int[] REUSEDELAY = new int[]
{
- 4, 42, 42, 16, 100, 10, 20
+ 4, 42, 42, 16, 100, 10, 20, 50
};

// protected actions
@@ -61,6 +61,7 @@
public static final int PROTECTED_HEROVOICE = 4;
public static final int PROTECTED_MULTISELL = 5;
public static final int PROTECTED_SUBCLASS = 6;
+ public static final int PROTECTED_TRADECHAT = 7;

// =========================================================
// Constructor
========================================================= //

Index: java/com/l2jserver/gameserver/handler/chathandlers/ChatTrade.java ===================================================================
--- java/com/l2jserver/gameserver/handler/chathandlers/ChatTrade.java
+++ java/com/l2jserver/gameserver/handler/chathandlers/ChatTrade.java
@@ -23,6 +23,7@@

import com.l2jserver.gameserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
+import com.l2jserver.gameserver.util.FloodProtector;

/**
* A chat handler
@@ -48,6 +49,12 @@

if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
{
+ if (!activeChar.isGM() && !FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_TRADECHAT))
+ {
+ activeChar.sendMessage("Action failed. Players are only able to speak in the global channel once every 5 seconds.");
+ return;
+ }
+
for (L2PcInstance player : pls)
{
if (!BlockList.isBlocked(player, activeChar))