Simplified flood protector methods.
This commit is contained in:
@@ -757,7 +757,6 @@ public class Config
|
||||
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_USE_ITEM;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_ROLL_DICE;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_FIREWORK;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_ITEM_PET_SUMMON;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_HERO_VOICE;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_GLOBAL_CHAT;
|
||||
@@ -768,13 +767,10 @@ public class Config
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_MULTISELL;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_TRANSACTION;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_MANUFACTURE;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_MANOR;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_CHARACTER_SELECT;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_PARTY_INVITATION;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_SAY_ACTION;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_MOVE_ACTION;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_MACRO;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_POTION;
|
||||
public static FloodProtectorConfig FLOOD_PROTECTOR_PLAYER_ACTION;
|
||||
|
||||
public static boolean CHECK_SKILLS_ON_ENTER;
|
||||
@@ -2194,7 +2190,6 @@ public class Config
|
||||
{
|
||||
FLOOD_PROTECTOR_USE_ITEM = new FloodProtectorConfig("UseItemFloodProtector");
|
||||
FLOOD_PROTECTOR_ROLL_DICE = new FloodProtectorConfig("RollDiceFloodProtector");
|
||||
FLOOD_PROTECTOR_FIREWORK = new FloodProtectorConfig("FireworkFloodProtector");
|
||||
FLOOD_PROTECTOR_ITEM_PET_SUMMON = new FloodProtectorConfig("ItemPetSummonFloodProtector");
|
||||
FLOOD_PROTECTOR_HERO_VOICE = new FloodProtectorConfig("HeroVoiceFloodProtector");
|
||||
FLOOD_PROTECTOR_GLOBAL_CHAT = new FloodProtectorConfig("GlobalChatFloodProtector");
|
||||
@@ -2205,13 +2200,10 @@ public class Config
|
||||
FLOOD_PROTECTOR_MULTISELL = new FloodProtectorConfig("MultiSellFloodProtector");
|
||||
FLOOD_PROTECTOR_TRANSACTION = new FloodProtectorConfig("TransactionFloodProtector");
|
||||
FLOOD_PROTECTOR_MANUFACTURE = new FloodProtectorConfig("ManufactureFloodProtector");
|
||||
FLOOD_PROTECTOR_MANOR = new FloodProtectorConfig("ManorFloodProtector");
|
||||
FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector");
|
||||
FLOOD_PROTECTOR_PARTY_INVITATION = new FloodProtectorConfig("PartyInvitationFloodProtector");
|
||||
FLOOD_PROTECTOR_SAY_ACTION = new FloodProtectorConfig("SayActionFloodProtector");
|
||||
FLOOD_PROTECTOR_MOVE_ACTION = new FloodProtectorConfig("MoveActionFloodProtector");
|
||||
FLOOD_PROTECTOR_MACRO = new FloodProtectorConfig("MacroFloodProtector");
|
||||
FLOOD_PROTECTOR_POTION = new FloodProtectorConfig("PotionFloodProtector");
|
||||
FLOOD_PROTECTOR_PLAYER_ACTION = new FloodProtectorConfig("PlayerActionFloodProtector");
|
||||
|
||||
final PropertiesParser floodProtectConfig = new PropertiesParser(PROTECT_FLOOD_CONFIG_FILE);
|
||||
@@ -2802,7 +2794,6 @@ public class Config
|
||||
{
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_USE_ITEM, "UseItem", 1);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", 42);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_FIREWORK, "Firework", 42);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ITEM_PET_SUMMON, "ItemPetSummon", 16);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_HERO_VOICE, "HeroVoice", 100);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_GLOBAL_CHAT, "GlobalChat", 5);
|
||||
@@ -2813,13 +2804,10 @@ public class Config
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MULTISELL, "MultiSell", 1);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_TRANSACTION, "Transaction", 10);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MANUFACTURE, "Manufacture", 3);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MANOR, "Manor", 30);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_CHARACTER_SELECT, "CharacterSelect", 30);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_PARTY_INVITATION, "PartyInvitation", 30);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SAY_ACTION, "SayAction", 100);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MOVE_ACTION, "MoveAction", 30);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MACRO, "Macro", 10);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_POTION, "Potion", 4);
|
||||
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_PLAYER_ACTION, "PlayerAction", 3);
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,6 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public class Firework implements IItemHandler
|
||||
{
|
||||
@@ -39,20 +38,11 @@ public class Firework implements IItemHandler
|
||||
@Override
|
||||
public void useItem(Playable playable, ItemInstance item)
|
||||
{
|
||||
if (!(playable instanceof PlayerInstance))
|
||||
if (!playable.isPlayer())
|
||||
{
|
||||
return; // prevent Class cast exception
|
||||
}
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) playable;
|
||||
final int itemId = item.getItemId();
|
||||
if (!player.getFloodProtectors().getFirework().tryPerformAction("firework"))
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addItemName(itemId);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
final PlayerInstance player = playable.getActingPlayer();
|
||||
|
||||
if (player.isCastingNow())
|
||||
{
|
||||
@@ -102,6 +92,7 @@ public class Firework implements IItemHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final int itemId = item.getItemId();
|
||||
if (itemId == 6403) // elven_firecracker, xml: 2023
|
||||
{
|
||||
final MagicSkillUse msu = new MagicSkillUse(playable, player, 2023, 1, 1, 0);
|
||||
|
@@ -50,7 +50,7 @@ public class RollingDice implements IItemHandler
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) playable;
|
||||
final int itemId = item.getItemId();
|
||||
if (!player.getFloodProtectors().getRollDice().tryPerformAction("RollDice"))
|
||||
if (!player.getClient().getFloodProtectors().canRollDice())
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addItemName(itemId);
|
||||
|
@@ -51,7 +51,7 @@ public class SummonItems implements IItemHandler
|
||||
}
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) playable;
|
||||
if (!player.getFloodProtectors().getItemPetSummon().tryPerformAction("summon pet"))
|
||||
if (!player.getClient().getFloodProtectors().canUsePetSummonItem())
|
||||
{
|
||||
playable.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
@@ -43,7 +43,7 @@ public class Craft implements ISkillHandler
|
||||
}
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) creature;
|
||||
if (!player.getFloodProtectors().getManufacture().tryPerformAction("craft"))
|
||||
if (!player.getClient().getFloodProtectors().canManufacture())
|
||||
{
|
||||
player.sendMessage("You cannot craft so fast!");
|
||||
return;
|
||||
|
@@ -37,7 +37,7 @@ public class BankingCmd implements IVoicedCommandHandler
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, PlayerInstance activeChar, String target)
|
||||
{
|
||||
if (!activeChar.getClient().getFloodProtectors().getTransaction().tryPerformAction("bank"))
|
||||
if (!activeChar.getClient().getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
activeChar.sendMessage("You Cannot Use The Banking System So Fast!");
|
||||
return true;
|
||||
|
@@ -1875,7 +1875,7 @@ public class NpcInstance extends Creature
|
||||
* <li>If player level is out of range, display a message and return</li>
|
||||
* <li>According to player level cast buff</li><br>
|
||||
* <font color=#FF0000><b> Newbie Helper Buff list is define in sql table helper_buff_list</b></font>
|
||||
* @param player The PlayerInstance that talk with the NpcInstance if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_USEITEM)) return;
|
||||
* @param player The PlayerInstance that talk with the NpcInstance if (!FloodProtector.getInstance().canPerformAction(player.getObjectId(), FloodProtector.PROTECTED_USEITEM)) return;
|
||||
*/
|
||||
public void makeSupportMagic(PlayerInstance player)
|
||||
{
|
||||
|
@@ -215,7 +215,6 @@ import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PvpFlagTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
import org.l2jmobius.gameserver.util.FloodProtectors;
|
||||
import org.l2jmobius.gameserver.util.IllegalPlayerAction;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@@ -15041,15 +15040,6 @@ public class PlayerInstance extends Playable
|
||||
_confirmDlgRequests.remove(requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flood protectors.
|
||||
* @return the flood protectors
|
||||
*/
|
||||
public FloodProtectors getFloodProtectors()
|
||||
{
|
||||
return _client.getFloodProtectors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if player inventory is under 80% capaity.
|
||||
* @return true, if is inventory under80
|
||||
|
@@ -327,7 +327,7 @@ public class VillageMasterInstance extends FolkInstance
|
||||
boolean allowAddition = true;
|
||||
|
||||
// Subclass exploit fix during add subclass
|
||||
if (!player.getFloodProtectors().getSubclass().tryPerformAction("add subclass"))
|
||||
if (!player.getClient().getFloodProtectors().canChangeSubclass())
|
||||
{
|
||||
LOGGER.warning("Player " + player.getName() + " has performed a subclass change too fast");
|
||||
player.setLocked(false);
|
||||
@@ -428,7 +428,7 @@ public class VillageMasterInstance extends FolkInstance
|
||||
player.setLocked(true);
|
||||
|
||||
// Subclass exploit fix during change subclass
|
||||
if (!player.getFloodProtectors().getSubclass().tryPerformAction("change subclass"))
|
||||
if (!player.getClient().getFloodProtectors().canChangeSubclass())
|
||||
{
|
||||
LOGGER.warning("Player " + player.getName() + " has performed a subclass change too fast");
|
||||
player.setLocked(false);
|
||||
@@ -489,7 +489,7 @@ public class VillageMasterInstance extends FolkInstance
|
||||
player.setLocked(true);
|
||||
|
||||
// Subclass exploit fix during delete subclass
|
||||
if (!player.getFloodProtectors().getSubclass().tryPerformAction("delete subclass"))
|
||||
if (!player.getClient().getFloodProtectors().canChangeSubclass())
|
||||
{
|
||||
LOGGER.warning("Player " + player.getName() + " has performed a subclass change too fast");
|
||||
player.setLocked(false);
|
||||
|
@@ -50,7 +50,7 @@ public class Action implements IClientIncomingPacket
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
|
||||
if (!client.getFloodProtectors().canPerformPlayerAction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public class AttackRequest implements IClientIncomingPacket
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
|
||||
if (!client.getFloodProtectors().canPerformPlayerAction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public class CharacterDelete implements IClientIncomingPacket
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterDelete"))
|
||||
if (!client.getFloodProtectors().canSelectCharacter())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ public class CharacterRestore implements IClientIncomingPacket
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterRestore"))
|
||||
if (!client.getFloodProtectors().canSelectCharacter())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public class CharacterSelected implements IClientIncomingPacket
|
||||
// to make this work, the first packet in the playback.dat has to be a [S]0x21 packet
|
||||
// after playback is done, the client will not work correct and need to exit
|
||||
// playLogFile(getConnection()); // try to play LOGGER file
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
|
||||
if (!client.getFloodProtectors().canSelectCharacter())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Move flood protection
|
||||
if (!client.getFloodProtectors().getMoveAction().tryPerformAction("MoveBackwardToLocation"))
|
||||
if (!client.getFloodProtectors().canPerformMoveAction())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
@@ -74,7 +74,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
|
||||
if (!client.getFloodProtectors().canUseMultiSell())
|
||||
{
|
||||
player.setMultiSellId(-1);
|
||||
return;
|
||||
|
@@ -298,7 +298,7 @@ public class RequestActionUse implements IClientIncomingPacket
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!player.getFloodProtectors().getItemPetSummon().tryPerformAction("mount"))
|
||||
if (!client.getFloodProtectors().canUsePetSummonItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ public class RequestBuyItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You buying too fast.");
|
||||
return;
|
||||
|
@@ -90,7 +90,7 @@ public class RequestBuyProcure implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getManor().tryPerformAction("BuyProcure"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ public class RequestBuySeed implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getManor().tryPerformAction("BuySeed"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ public class RequestBypassToServer implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getServerBypass().tryPerformAction(_command))
|
||||
if (!client.getFloodProtectors().canUseServerBypass())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ public class RequestCrystallizeItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You crystallizing too fast.");
|
||||
return;
|
||||
|
@@ -41,7 +41,7 @@ public class RequestDeleteMacro implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Macro exploit fix
|
||||
if (!client.getFloodProtectors().getMacro().tryPerformAction("delete macro"))
|
||||
if (!client.getFloodProtectors().canUseMacro())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ public class RequestDestroyItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("destroy"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You destroying items too fast.");
|
||||
return;
|
||||
|
@@ -75,7 +75,7 @@ public class RequestDropItem implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Flood protect drop to avoid packet lag
|
||||
if (!client.getFloodProtectors().getDropItem().tryPerformAction("drop item"))
|
||||
if (!client.getFloodProtectors().canDropItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Flood protect to enchant script
|
||||
if (!client.getFloodProtectors().getEnchantItem().tryPerformAction("enchant"))
|
||||
if (!client.getFloodProtectors().canEnchantItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
/*
|
||||
* if(!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_ENCHANT)) { activeChar.setActiveEnchantItem(null); activeChar.sendMessage("Enchant failed"); return; }
|
||||
* if(!FloodProtector.getInstance().canPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_ENCHANT)) { activeChar.setActiveEnchantItem(null); activeChar.sendMessage("Enchant failed"); return; }
|
||||
*/
|
||||
|
||||
if (item.isWear())
|
||||
|
@@ -52,7 +52,7 @@ public class RequestGetItemFromPet implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("getfrompet"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You get items from pet too fast.");
|
||||
return;
|
||||
|
@@ -48,7 +48,7 @@ public class RequestGiveItemToPet implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("giveitemtopet"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You give items to pet too fast.");
|
||||
return;
|
||||
|
@@ -43,18 +43,12 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance requestor = client.getPlayer();
|
||||
final PlayerInstance target = World.getInstance().getPlayer(_name);
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getPartyInvitation().tryPerformAction("PartyInvitation"))
|
||||
{
|
||||
requestor.sendMessage("You cannot invite into party so fast!");
|
||||
return;
|
||||
}
|
||||
|
||||
final PlayerInstance target = World.getInstance().getPlayer(_name);
|
||||
if (target == null)
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.THAT_IS_THE_INCORRECT_TARGET);
|
||||
@@ -113,14 +107,8 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* @param requestor
|
||||
*/
|
||||
private void addTargetToParty(PlayerInstance target, PlayerInstance requestor)
|
||||
{
|
||||
SystemMessage msg;
|
||||
|
||||
// summary of ppl already in party and ppl that get invitation
|
||||
if (requestor.getParty().getMemberCount() >= 9)
|
||||
{
|
||||
@@ -140,6 +128,7 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage msg;
|
||||
if (!target.isProcessingRequest())
|
||||
{
|
||||
requestor.onTransactionRequest(target);
|
||||
@@ -158,10 +147,6 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* @param requestor
|
||||
*/
|
||||
private void createNewParty(PlayerInstance target, PlayerInstance requestor)
|
||||
{
|
||||
SystemMessage msg;
|
||||
|
@@ -76,7 +76,7 @@ public class RequestMakeMacro implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Macro exploit fix
|
||||
if (!client.getFloodProtectors().getMacro().tryPerformAction("make macro"))
|
||||
if (!client.getFloodProtectors().canUseMacro())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ public class RequestPackageSend implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("deposit"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You depositing items too fast.");
|
||||
return;
|
||||
|
@@ -50,7 +50,7 @@ public class RequestPackageSendableItemList implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("deposit"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You depositing items too fast.");
|
||||
return;
|
||||
|
@@ -49,7 +49,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getUseItem().tryPerformAction("pet use item"))
|
||||
if (!client.getFloodProtectors().canUseItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ public class RequestPrivateStoreBuy implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestorebuy"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You buying items too fast.");
|
||||
return;
|
||||
|
@@ -88,7 +88,7 @@ public class RequestPrivateStoreSell implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestoresell"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You selling items too fast");
|
||||
return;
|
||||
|
@@ -43,7 +43,7 @@ public class RequestRecipeBookDestroy implements IClientIncomingPacket
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("RecipeDestroy"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public class RequestRecipeItemMakeSelf implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeMakeSelf"))
|
||||
if (!client.getFloodProtectors().canManufacture())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ public class RequestRecipeShopMakeItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeShopMake"))
|
||||
if (!client.getFloodProtectors().canManufacture())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ public class RequestSellItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You buying too fast.");
|
||||
return;
|
||||
|
@@ -124,7 +124,7 @@ public class Say2 implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getSayAction().tryPerformAction("Say2"))
|
||||
if (!client.getFloodProtectors().canPerformSayAction())
|
||||
{
|
||||
player.sendMessage("You cannot speak too fast.");
|
||||
return;
|
||||
@@ -237,7 +237,7 @@ public class Say2 implements IClientIncomingPacket
|
||||
case SHOUT:
|
||||
{
|
||||
// Flood protect Say
|
||||
if (!client.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
|
||||
if (!client.getFloodProtectors().canUseGlobalChat())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -509,7 +509,7 @@ public class Say2 implements IClientIncomingPacket
|
||||
else if (player.isHero())
|
||||
{
|
||||
// Flood protect Hero Voice
|
||||
if (!client.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
|
||||
if (!client.getFloodProtectors().canUseHeroVoice())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ public class SendWareHouseDepositList implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("deposit"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You depositing items too fast.");
|
||||
return;
|
||||
|
@@ -75,7 +75,7 @@ public class SendWareHouseWithDrawList implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("withdraw"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You withdrawing items too fast.");
|
||||
return;
|
||||
|
@@ -45,7 +45,7 @@ public class TradeDone implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("trade"))
|
||||
if (!client.getFloodProtectors().canPerformTransaction())
|
||||
{
|
||||
player.sendMessage("You are trading too fast.");
|
||||
return;
|
||||
|
@@ -108,14 +108,7 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Flood protect UseItem
|
||||
if (item.isPotion())
|
||||
{
|
||||
if (!client.getFloodProtectors().getUsePotion().tryPerformAction("use potion"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!client.getFloodProtectors().getUseItem().tryPerformAction("use item"))
|
||||
if (!client.getFloodProtectors().canUseItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -75,10 +75,9 @@ public class FloodProtectorAction
|
||||
|
||||
/**
|
||||
* Checks whether the request is flood protected or not.
|
||||
* @param command command issued or short command description
|
||||
* @return true if action is allowed, otherwise false
|
||||
*/
|
||||
public boolean tryPerformAction(String command)
|
||||
public boolean canPerformAction()
|
||||
{
|
||||
if ((_client.getPlayer() != null) && _client.getPlayer().isGM())
|
||||
{
|
||||
@@ -90,7 +89,7 @@ public class FloodProtectorAction
|
||||
{
|
||||
if (_config.LOG_FLOODING && !_logged && LOGGER.isLoggable(Level.WARNING))
|
||||
{
|
||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeTaskManager.MILLIS_IN_TICK), " ms after previous command");
|
||||
log(" called command ", _config.FLOOD_PROTECTOR_TYPE, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeTaskManager.MILLIS_IN_TICK), " ms after previous command");
|
||||
_logged = true;
|
||||
}
|
||||
|
||||
|
@@ -25,89 +25,22 @@ import org.l2jmobius.gameserver.network.GameClient;
|
||||
*/
|
||||
public class FloodProtectors
|
||||
{
|
||||
/**
|
||||
* Use-item flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _useItem;
|
||||
/**
|
||||
* Roll-dice flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _rollDice;
|
||||
/**
|
||||
* Firework flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _firework;
|
||||
/**
|
||||
* Item-pet-summon flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _itemPetSummon;
|
||||
/**
|
||||
* Hero-voice flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _heroVoice;
|
||||
/**
|
||||
* Global-chat flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _globalChat;
|
||||
/**
|
||||
* Subclass flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _subclass;
|
||||
/**
|
||||
* Drop-item flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _dropItem;
|
||||
/**
|
||||
* enchantItem flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _enchantItem;
|
||||
/**
|
||||
* Server-bypass flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _serverBypass;
|
||||
/**
|
||||
* Multisell flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _multiSell;
|
||||
/**
|
||||
* Transaction flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _transaction;
|
||||
/**
|
||||
* Manufacture flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _manufacture;
|
||||
/**
|
||||
* Manor flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _manor;
|
||||
/**
|
||||
* Character Select protector
|
||||
*/
|
||||
private final FloodProtectorAction _characterSelect;
|
||||
/**
|
||||
* Party Invitation flood protector.
|
||||
*/
|
||||
private final FloodProtectorAction _partyInvitation;
|
||||
/**
|
||||
* Say Action protector
|
||||
*/
|
||||
private final FloodProtectorAction _sayAction;
|
||||
/**
|
||||
* Move Action protector
|
||||
*/
|
||||
private final FloodProtectorAction _moveAction;
|
||||
/**
|
||||
* Macro protector
|
||||
*/
|
||||
private final FloodProtectorAction _macro;
|
||||
/**
|
||||
* Potion protector
|
||||
*/
|
||||
private final FloodProtectorAction _potion;
|
||||
/**
|
||||
* Player Action
|
||||
*/
|
||||
private final FloodProtectorAction _playerAction;
|
||||
|
||||
/**
|
||||
@@ -119,7 +52,6 @@ public class FloodProtectors
|
||||
super();
|
||||
_useItem = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_USE_ITEM);
|
||||
_rollDice = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ROLL_DICE);
|
||||
_firework = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_FIREWORK);
|
||||
_itemPetSummon = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ITEM_PET_SUMMON);
|
||||
_heroVoice = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_HERO_VOICE);
|
||||
_globalChat = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_GLOBAL_CHAT);
|
||||
@@ -130,198 +62,95 @@ public class FloodProtectors
|
||||
_multiSell = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MULTISELL);
|
||||
_transaction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_TRANSACTION);
|
||||
_manufacture = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MANUFACTURE);
|
||||
_manor = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MANOR);
|
||||
_characterSelect = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_CHARACTER_SELECT);
|
||||
_partyInvitation = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_PARTY_INVITATION);
|
||||
_sayAction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SAY_ACTION);
|
||||
_moveAction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MOVE_ACTION);
|
||||
_macro = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MACRO);
|
||||
_potion = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_POTION);
|
||||
_playerAction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_PLAYER_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_useItem}.
|
||||
* @return {@link #_useItem}
|
||||
*/
|
||||
public FloodProtectorAction getUseItem()
|
||||
public boolean canUseItem()
|
||||
{
|
||||
return _useItem;
|
||||
return _useItem.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_rollDice}.
|
||||
* @return {@link #_rollDice}
|
||||
*/
|
||||
public FloodProtectorAction getRollDice()
|
||||
public boolean canRollDice()
|
||||
{
|
||||
return _rollDice;
|
||||
return _rollDice.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_firework}.
|
||||
* @return {@link #_firework}
|
||||
*/
|
||||
public FloodProtectorAction getFirework()
|
||||
public boolean canUsePetSummonItem()
|
||||
{
|
||||
return _firework;
|
||||
return _itemPetSummon.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_itemPetSummon}.
|
||||
* @return {@link #_itemPetSummon}
|
||||
*/
|
||||
public FloodProtectorAction getItemPetSummon()
|
||||
public boolean canUseHeroVoice()
|
||||
{
|
||||
return _itemPetSummon;
|
||||
return _heroVoice.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_heroVoice}.
|
||||
* @return {@link #_heroVoice}
|
||||
*/
|
||||
public FloodProtectorAction getHeroVoice()
|
||||
public boolean canUseGlobalChat()
|
||||
{
|
||||
return _heroVoice;
|
||||
return _globalChat.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_globalChat}.
|
||||
* @return {@link #_globalChat}
|
||||
*/
|
||||
public FloodProtectorAction getGlobalChat()
|
||||
public boolean canChangeSubclass()
|
||||
{
|
||||
return _globalChat;
|
||||
return _subclass.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_subclass}.
|
||||
* @return {@link #_subclass}
|
||||
*/
|
||||
public FloodProtectorAction getSubclass()
|
||||
public boolean canDropItem()
|
||||
{
|
||||
return _subclass;
|
||||
return _dropItem.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_dropItem}.
|
||||
* @return {@link #_dropItem}
|
||||
*/
|
||||
public FloodProtectorAction getDropItem()
|
||||
public boolean canEnchantItem()
|
||||
{
|
||||
return _dropItem;
|
||||
return _enchantItem.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_enchantItem}.
|
||||
* @return {@link #_enchantItem}
|
||||
*/
|
||||
public FloodProtectorAction getEnchantItem()
|
||||
public boolean canUseServerBypass()
|
||||
{
|
||||
return _enchantItem;
|
||||
return _serverBypass.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_serverBypass}.
|
||||
* @return {@link #_serverBypass}
|
||||
*/
|
||||
public FloodProtectorAction getServerBypass()
|
||||
public boolean canUseMultiSell()
|
||||
{
|
||||
return _serverBypass;
|
||||
return _multiSell.canPerformAction();
|
||||
}
|
||||
|
||||
public FloodProtectorAction getMultiSell()
|
||||
public boolean canPerformTransaction()
|
||||
{
|
||||
return _multiSell;
|
||||
return _transaction.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_transaction}.
|
||||
* @return {@link #_transaction}
|
||||
*/
|
||||
public FloodProtectorAction getTransaction()
|
||||
public boolean canManufacture()
|
||||
{
|
||||
return _transaction;
|
||||
return _manufacture.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_manufacture}.
|
||||
* @return {@link #_manufacture}
|
||||
*/
|
||||
public FloodProtectorAction getManufacture()
|
||||
public boolean canSelectCharacter()
|
||||
{
|
||||
return _manufacture;
|
||||
return _characterSelect.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_manor}.
|
||||
* @return {@link #_manor}
|
||||
*/
|
||||
public FloodProtectorAction getManor()
|
||||
public boolean canPerformSayAction()
|
||||
{
|
||||
return _manor;
|
||||
return _sayAction.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_characterSelect}.
|
||||
* @return {@link #_characterSelect}
|
||||
*/
|
||||
public FloodProtectorAction getCharacterSelect()
|
||||
public boolean canPerformMoveAction()
|
||||
{
|
||||
return _characterSelect;
|
||||
return _moveAction.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_partyInvitation}.
|
||||
* @return {@link #_partyInvitation}
|
||||
*/
|
||||
public FloodProtectorAction getPartyInvitation()
|
||||
public boolean canUseMacro()
|
||||
{
|
||||
return _partyInvitation;
|
||||
return _macro.canPerformAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_sayAction}.
|
||||
* @return {@link #_sayAction}
|
||||
*/
|
||||
public FloodProtectorAction getSayAction()
|
||||
public boolean canPerformPlayerAction()
|
||||
{
|
||||
return _sayAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_moveAction}.
|
||||
* @return {@link #_moveAction}
|
||||
*/
|
||||
public FloodProtectorAction getMoveAction()
|
||||
{
|
||||
return _moveAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_macro}.
|
||||
* @return {@link #_macro}
|
||||
*/
|
||||
public FloodProtectorAction getMacro()
|
||||
{
|
||||
return _macro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_potion}.
|
||||
* @return {@link #_potion}
|
||||
*/
|
||||
public FloodProtectorAction getUsePotion()
|
||||
{
|
||||
return _potion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link #_playerAction}.
|
||||
* @return {@link #_playerAction}
|
||||
*/
|
||||
public FloodProtectorAction getPlayerAction()
|
||||
{
|
||||
return _playerAction;
|
||||
return _playerAction.canPerformAction();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user