Simplified flood protector methods.

This commit is contained in:
MobiusDevelopment 2021-11-09 16:01:26 +00:00
parent e3691a48d9
commit 6da66f9503
1252 changed files with 1977 additions and 6239 deletions

View File

@ -24,13 +24,6 @@ FloodProtectorRollDicePunishmentLimit = 0
FloodProtectorRollDicePunishmentType = none
FloodProtectorRollDicePunishmentTime = 0
# Firework - firework flooding
FloodProtectorFireworkInterval = 42
FloodProtectorFireworkLogFlooding = False
FloodProtectorFireworkPunishmentLimit = 0
FloodProtectorFireworkPunishmentType = none
FloodProtectorFireworkPunishmentTime = 0
# ItemPetSummon - item summoning and pet mounting flooding
FloodProtectorItemPetSummonInterval = 16
FloodProtectorItemPetSummonLogFlooding = False
@ -94,13 +87,6 @@ FloodProtectorManufacturePunishmentLimit = 0
FloodProtectorManufacturePunishmentType = none
FloodProtectorManufacturePunishmentTime = 0
# Manor
FloodProtectorManorInterval = 30
FloodProtectorManorLogFlooding = False
FloodProtectorManorPunishmentLimit = 0
FloodProtectorManorPunishmentType = none
FloodProtectorManorPunishmentTime = 0
# SendMail - sending mail interval, 10s on retail
FloodProtectorSendMailInterval = 100
FloodProtectorSendMailLogFlooding = False

View File

@ -72,7 +72,7 @@ public class ItemAuctionLink implements IBypassHandler
final String cmd = st.nextToken();
if ("show".equalsIgnoreCase(cmd))
{
if (!player.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
if (!player.getClient().getFloodProtectors().canUseItemAuction())
{
return false;
}

View File

@ -56,7 +56,7 @@ public class ChatHeroVoice implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
if (!activeChar.getClient().getFloodProtectors().canUseHeroVoice())
{
activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds.");
return;

View File

@ -89,7 +89,7 @@ public class ChatShout implements IChatHandler
}
else if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getClient().getFloodProtectors().canUseGlobalChat())
{
activeChar.sendMessage("Do not spam shout channel.");
return;

View File

@ -89,7 +89,7 @@ public class ChatTrade implements IChatHandler
}
else if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getClient().getFloodProtectors().canUseGlobalChat())
{
activeChar.sendMessage("Do not spam trade channel.");
return;

View File

@ -84,14 +84,10 @@ public class RollingDice implements IItemHandler
return true;
}
/**
* @param player
* @return
*/
private int rollDice(PlayerInstance player)
{
// Check if the dice is ready
if (!player.getFloodProtectors().getRollDice().tryPerformAction("roll dice"))
if (!player.getClient().getFloodProtectors().canRollDice())
{
return 0;
}

View File

@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate
}
final PlayerInstance player = playable.getActingPlayer();
if (!player.getFloodProtectors().getItemPetSummon().tryPerformAction("summon items") || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow())
if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow())
{
return false;
}

View File

@ -599,7 +599,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;
@ -609,7 +608,6 @@ 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_SENDMAIL;
public static FloodProtectorConfig FLOOD_PROTECTOR_CHARACTER_SELECT;
public static FloodProtectorConfig FLOOD_PROTECTOR_ITEM_AUCTION;
@ -1346,7 +1344,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");
@ -1356,7 +1353,6 @@ 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_SENDMAIL = new FloodProtectorConfig("SendMailFloodProtector");
FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector");
FLOOD_PROTECTOR_ITEM_AUCTION = new FloodProtectorConfig("ItemAuctionFloodProtector");
@ -3665,7 +3661,6 @@ public class Config
{
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_USE_ITEM, "UseItem", 4);
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);
@ -3675,7 +3670,6 @@ 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_SENDMAIL, "SendMail", 100);
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_CHARACTER_SELECT, "CharacterSelect", 30);
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ITEM_AUCTION, "ItemAuction", 9);

View File

@ -346,7 +346,6 @@ import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
import org.l2jmobius.gameserver.taskmanager.PvpFlagTaskManager;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.EnumIntBitmask;
import org.l2jmobius.gameserver.util.FloodProtectors;
import org.l2jmobius.gameserver.util.Util;
/**
@ -11965,11 +11964,6 @@ public class PlayerInstance extends Playable
return _isInHideoutSiege;
}
public FloodProtectors getFloodProtectors()
{
return _client.getFloodProtectors();
}
public boolean isFlyingMounted()
{
return checkTransformed(Transform::isFlying);

View File

@ -54,7 +54,7 @@ public class Action implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
if (!client.getFloodProtectors().canPerformPlayerAction())
{
return;
}

View File

@ -56,7 +56,7 @@ public class AttackRequest implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
if (!client.getFloodProtectors().canPerformPlayerAction())
{
return;
}

View File

@ -47,7 +47,7 @@ public class CharacterDelete implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
// if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterDelete"))
// if (!client.getFloodProtectors().canSelectCharacter())
// {
// client.sendPacket(new CharDeleteFail(CharacterDeleteFailType.UNKNOWN));
// return;

View File

@ -41,7 +41,7 @@ public class CharacterRestore implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterRestore"))
if (!client.getFloodProtectors().canSelectCharacter())
{
return;
}

View File

@ -74,7 +74,7 @@ public class CharacterSelect implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
if (!client.getFloodProtectors().canSelectCharacter())
{
return;
}

View File

@ -94,7 +94,7 @@ public class MultiSellChoose implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
if (!client.getFloodProtectors().canUseMultiSell())
{
player.setMultiSell(null);
return;

View File

@ -50,7 +50,7 @@ public class RequestBidItemAuction implements IClientIncomingPacket
}
// can't use auction fp here
if (!client.getFloodProtectors().getTransaction().tryPerformAction("auction"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are bidding too fast.");
return;

View File

@ -82,7 +82,7 @@ public class RequestBuyItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -83,7 +83,7 @@ public class RequestBuySeed implements IClientIncomingPacket
{
return;
}
else if (!client.getFloodProtectors().getManor().tryPerformAction("BuySeed"))
else if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying seeds too fast!");
return;

View File

@ -121,7 +121,7 @@ public class RequestBypassToServer implements IClientIncomingPacket
}
}
if (!client.getFloodProtectors().getServerBypass().tryPerformAction(_command))
if (!client.getFloodProtectors().canUseServerBypass())
{
return;
}

View File

@ -57,7 +57,7 @@ public class RequestCancelPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("cancelpost"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -63,7 +63,7 @@ public class RequestCrystallizeItem implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -72,7 +72,7 @@ public class RequestDestroyItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("destroy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are destroying items too fast.");
return;

View File

@ -68,7 +68,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;
}

View File

@ -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;

View File

@ -51,7 +51,7 @@ public class RequestGiveItemToPet implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("giveitemtopet"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are giving items to pet too fast.");
return;

View File

@ -52,7 +52,7 @@ public class RequestHennaEquip implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("HennaEquip"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -46,7 +46,7 @@ public class RequestHennaRemove implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("HennaRemove"))
if (!client.getFloodProtectors().canPerformTransaction())
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;

View File

@ -47,7 +47,7 @@ public class RequestInfoItemAuction implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
if (!client.getFloodProtectors().canUseItemAuction())
{
return;
}

View File

@ -78,7 +78,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;

View File

@ -50,7 +50,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getUseItem().tryPerformAction("pet use item"))
if (!client.getFloodProtectors().canUseItem())
{
return;
}

View File

@ -65,7 +65,7 @@ public class RequestPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("getattach"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -120,7 +120,7 @@ public class RequestPreviewItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -91,7 +91,7 @@ public class RequestPrivateStoreBuy implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestorebuy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying items too fast.");
return;

View File

@ -88,7 +88,7 @@ public class RequestPrivateStoreSell implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestoresell"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are selling items too fast.");
return;

View File

@ -43,7 +43,7 @@ public class RequestRecipeBookDestroy implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("RecipeDestroy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -45,7 +45,7 @@ public class RequestRecipeItemMakeSelf implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeMakeSelf"))
if (!client.getFloodProtectors().canManufacture())
{
return;
}

View File

@ -52,7 +52,7 @@ public class RequestRecipeShopMakeItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeShopMake"))
if (!client.getFloodProtectors().canManufacture())
{
return;
}

View File

@ -72,7 +72,7 @@ public class RequestRefundItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("refund"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are using refund too fast.");
return;

View File

@ -58,7 +58,7 @@ public class RequestRejectPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("rejectattach"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -82,7 +82,7 @@ public class RequestSellItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -249,7 +249,7 @@ public class RequestSendPost implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getSendMail().tryPerformAction("sendmail"))
if (!client.getFloodProtectors().canSendMail())
{
player.sendPacket(SystemMessageId.THE_PREVIOUS_MAIL_WAS_FORWARDED_LESS_THAN_1_MINUTE_AGO_AND_THIS_CANNOT_BE_FORWARDED);
return;

View File

@ -81,7 +81,7 @@ public class SendWareHouseDepositList implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("deposit"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are depositing items too fast.");
return;

View File

@ -77,7 +77,7 @@ public class SendWareHouseWithDrawList implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("withdraw"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are withdrawing items too fast.");
return;

View File

@ -46,7 +46,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;

View File

@ -72,7 +72,7 @@ public class UseItem implements IClientIncomingPacket
}
// Flood protect UseItem
if (!client.getFloodProtectors().getUseItem().tryPerformAction("use item"))
if (!client.getFloodProtectors().canUseItem())
{
return;
}

View File

@ -59,7 +59,7 @@ public class RequestCrystallizeEstimate implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -41,7 +41,7 @@ public class RequestCrystallizeItemCancel implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -82,10 +82,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().canOverrideCond(PlayerCondOverride.FLOOD_CONDITIONS))
{
@ -97,7 +96,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;
}

View File

@ -25,73 +25,20 @@ 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;
/**
* 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;
/**
* Send mail flood protector.
*/
private final FloodProtectorAction _sendMail;
/**
* Character Select protector
*/
private final FloodProtectorAction _characterSelect;
/**
* Item Auction
*/
private final FloodProtectorAction _itemAuction;
/**
* Player Action
*/
private final FloodProtectorAction _playerAction;
/**
@ -103,7 +50,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);
@ -113,162 +59,84 @@ 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);
_sendMail = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SENDMAIL);
_characterSelect = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_CHARACTER_SELECT);
_itemAuction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ITEM_AUCTION);
_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 canUseServerBypass()
{
return _dropItem;
return _serverBypass.canPerformAction();
}
/**
* Returns {@link #_serverBypass}.
* @return {@link #_serverBypass}
*/
public FloodProtectorAction getServerBypass()
public boolean canUseMultiSell()
{
return _serverBypass;
return _multiSell.canPerformAction();
}
/**
* @return {@link #_multiSell}
*/
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 canSendMail()
{
return _manufacture;
return _sendMail.canPerformAction();
}
/**
* Returns {@link #_manor}.
* @return {@link #_manor}
*/
public FloodProtectorAction getManor()
public boolean canSelectCharacter()
{
return _manor;
return _characterSelect.canPerformAction();
}
/**
* Returns {@link #_sendMail}.
* @return {@link #_sendMail}
*/
public FloodProtectorAction getSendMail()
public boolean canUseItemAuction()
{
return _sendMail;
return _itemAuction.canPerformAction();
}
/**
* Returns {@link #_characterSelect}.
* @return {@link #_characterSelect}
*/
public FloodProtectorAction getCharacterSelect()
public boolean canPerformPlayerAction()
{
return _characterSelect;
}
/**
* Returns {@link #_itemAuction}.
* @return {@link #_itemAuction}
*/
public FloodProtectorAction getItemAuction()
{
return _itemAuction;
}
/**
* Returns {@link #_playerAction}.
* @return {@link #_playerAction}
*/
public FloodProtectorAction getPlayerAction()
{
return _playerAction;
return _playerAction.canPerformAction();
}
}

View File

@ -24,13 +24,6 @@ FloodProtectorRollDicePunishmentLimit = 0
FloodProtectorRollDicePunishmentType = none
FloodProtectorRollDicePunishmentTime = 0
# Firework - firework flooding
FloodProtectorFireworkInterval = 42
FloodProtectorFireworkLogFlooding = False
FloodProtectorFireworkPunishmentLimit = 0
FloodProtectorFireworkPunishmentType = none
FloodProtectorFireworkPunishmentTime = 0
# ItemPetSummon - item summoning and pet mounting flooding
FloodProtectorItemPetSummonInterval = 16
FloodProtectorItemPetSummonLogFlooding = False
@ -94,13 +87,6 @@ FloodProtectorManufacturePunishmentLimit = 0
FloodProtectorManufacturePunishmentType = none
FloodProtectorManufacturePunishmentTime = 0
# Manor
FloodProtectorManorInterval = 30
FloodProtectorManorLogFlooding = False
FloodProtectorManorPunishmentLimit = 0
FloodProtectorManorPunishmentType = none
FloodProtectorManorPunishmentTime = 0
# SendMail - sending mail interval, 10s on retail
FloodProtectorSendMailInterval = 100
FloodProtectorSendMailLogFlooding = False

View File

@ -72,7 +72,7 @@ public class ItemAuctionLink implements IBypassHandler
final String cmd = st.nextToken();
if ("show".equalsIgnoreCase(cmd))
{
if (!player.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
if (!player.getClient().getFloodProtectors().canUseItemAuction())
{
return false;
}

View File

@ -56,7 +56,7 @@ public class ChatHeroVoice implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
if (!activeChar.getClient().getFloodProtectors().canUseHeroVoice())
{
activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds.");
return;

View File

@ -89,7 +89,7 @@ public class ChatShout implements IChatHandler
}
else if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getClient().getFloodProtectors().canUseGlobalChat())
{
activeChar.sendMessage("Do not spam shout channel.");
return;

View File

@ -89,7 +89,7 @@ public class ChatTrade implements IChatHandler
}
else if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
if (!activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS) && !activeChar.getClient().getFloodProtectors().canUseGlobalChat())
{
activeChar.sendMessage("Do not spam trade channel.");
return;

View File

@ -84,14 +84,10 @@ public class RollingDice implements IItemHandler
return true;
}
/**
* @param player
* @return
*/
private int rollDice(PlayerInstance player)
{
// Check if the dice is ready
if (!player.getFloodProtectors().getRollDice().tryPerformAction("roll dice"))
if (!player.getClient().getFloodProtectors().canRollDice())
{
return 0;
}

View File

@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate
}
final PlayerInstance player = playable.getActingPlayer();
if (!player.getFloodProtectors().getItemPetSummon().tryPerformAction("summon items") || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow())
if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow())
{
return false;
}

View File

@ -609,7 +609,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;
@ -619,7 +618,6 @@ 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_SENDMAIL;
public static FloodProtectorConfig FLOOD_PROTECTOR_CHARACTER_SELECT;
public static FloodProtectorConfig FLOOD_PROTECTOR_ITEM_AUCTION;
@ -1357,7 +1355,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");
@ -1367,7 +1364,6 @@ 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_SENDMAIL = new FloodProtectorConfig("SendMailFloodProtector");
FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector");
FLOOD_PROTECTOR_ITEM_AUCTION = new FloodProtectorConfig("ItemAuctionFloodProtector");
@ -3689,7 +3685,6 @@ public class Config
{
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_USE_ITEM, "UseItem", 4);
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);
@ -3699,7 +3694,6 @@ 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_SENDMAIL, "SendMail", 100);
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_CHARACTER_SELECT, "CharacterSelect", 30);
loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ITEM_AUCTION, "ItemAuction", 9);

View File

@ -348,7 +348,6 @@ import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
import org.l2jmobius.gameserver.taskmanager.PvpFlagTaskManager;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.EnumIntBitmask;
import org.l2jmobius.gameserver.util.FloodProtectors;
import org.l2jmobius.gameserver.util.Util;
/**
@ -11968,11 +11967,6 @@ public class PlayerInstance extends Playable
return _isInHideoutSiege;
}
public FloodProtectors getFloodProtectors()
{
return _client.getFloodProtectors();
}
public boolean isFlyingMounted()
{
return checkTransformed(Transform::isFlying);

View File

@ -54,7 +54,7 @@ public class Action implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
if (!client.getFloodProtectors().canPerformPlayerAction())
{
return;
}

View File

@ -56,7 +56,7 @@ public class AttackRequest implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getPlayerAction().tryPerformAction("PlayerAction"))
if (!client.getFloodProtectors().canPerformPlayerAction())
{
return;
}

View File

@ -47,7 +47,7 @@ public class CharacterDelete implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
// if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterDelete"))
// if (!client.getFloodProtectors().canSelectCharacter())
// {
// client.sendPacket(new CharDeleteFail(CharacterDeleteFailType.UNKNOWN));
// return;

View File

@ -41,7 +41,7 @@ public class CharacterRestore implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterRestore"))
if (!client.getFloodProtectors().canSelectCharacter())
{
return;
}

View File

@ -74,7 +74,7 @@ public class CharacterSelect implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
if (!client.getFloodProtectors().canSelectCharacter())
{
return;
}

View File

@ -111,7 +111,7 @@ public class MultiSellChoose implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
if (!client.getFloodProtectors().canUseMultiSell())
{
player.setMultiSell(null);
return;

View File

@ -50,7 +50,7 @@ public class RequestBidItemAuction implements IClientIncomingPacket
}
// can't use auction fp here
if (!client.getFloodProtectors().getTransaction().tryPerformAction("auction"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are bidding too fast.");
return;

View File

@ -82,7 +82,7 @@ public class RequestBuyItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -83,7 +83,7 @@ public class RequestBuySeed implements IClientIncomingPacket
{
return;
}
else if (!client.getFloodProtectors().getManor().tryPerformAction("BuySeed"))
else if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying seeds too fast!");
return;

View File

@ -121,7 +121,7 @@ public class RequestBypassToServer implements IClientIncomingPacket
}
}
if (!client.getFloodProtectors().getServerBypass().tryPerformAction(_command))
if (!client.getFloodProtectors().canUseServerBypass())
{
return;
}

View File

@ -57,7 +57,7 @@ public class RequestCancelPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("cancelpost"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -63,7 +63,7 @@ public class RequestCrystallizeItem implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -72,7 +72,7 @@ public class RequestDestroyItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("destroy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are destroying items too fast.");
return;

View File

@ -68,7 +68,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;
}

View File

@ -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;

View File

@ -51,7 +51,7 @@ public class RequestGiveItemToPet implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("giveitemtopet"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are giving items to pet too fast.");
return;

View File

@ -52,7 +52,7 @@ public class RequestHennaEquip implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("HennaEquip"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -46,7 +46,7 @@ public class RequestHennaRemove implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("HennaRemove"))
if (!client.getFloodProtectors().canPerformTransaction())
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;

View File

@ -47,7 +47,7 @@ public class RequestInfoItemAuction implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
if (!client.getFloodProtectors().canUseItemAuction())
{
return;
}

View File

@ -78,7 +78,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;

View File

@ -50,7 +50,7 @@ public class RequestPetUseItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getUseItem().tryPerformAction("pet use item"))
if (!client.getFloodProtectors().canUseItem())
{
return;
}

View File

@ -65,7 +65,7 @@ public class RequestPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("getattach"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -120,7 +120,7 @@ public class RequestPreviewItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -91,7 +91,7 @@ public class RequestPrivateStoreBuy implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestorebuy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying items too fast.");
return;

View File

@ -88,7 +88,7 @@ public class RequestPrivateStoreSell implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("privatestoresell"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are selling items too fast.");
return;

View File

@ -43,7 +43,7 @@ public class RequestRecipeBookDestroy implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("RecipeDestroy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -45,7 +45,7 @@ public class RequestRecipeItemMakeSelf implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeMakeSelf"))
if (!client.getFloodProtectors().canManufacture())
{
return;
}

View File

@ -52,7 +52,7 @@ public class RequestRecipeShopMakeItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getManufacture().tryPerformAction("RecipeShopMake"))
if (!client.getFloodProtectors().canManufacture())
{
return;
}

View File

@ -72,7 +72,7 @@ public class RequestRefundItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("refund"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are using refund too fast.");
return;

View File

@ -58,7 +58,7 @@ public class RequestRejectPostAttachment implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("rejectattach"))
if (!client.getFloodProtectors().canPerformTransaction())
{
return;
}

View File

@ -82,7 +82,7 @@ public class RequestSellItem implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are buying too fast.");
return;

View File

@ -249,7 +249,7 @@ public class RequestSendPost implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getSendMail().tryPerformAction("sendmail"))
if (!client.getFloodProtectors().canSendMail())
{
player.sendPacket(SystemMessageId.THE_PREVIOUS_MAIL_WAS_FORWARDED_LESS_THAN_1_MINUTE_AGO_AND_THIS_CANNOT_BE_FORWARDED);
return;

View File

@ -81,7 +81,7 @@ public class SendWareHouseDepositList implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("deposit"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are depositing items too fast.");
return;

View File

@ -77,7 +77,7 @@ public class SendWareHouseWithDrawList implements IClientIncomingPacket
return;
}
if (!client.getFloodProtectors().getTransaction().tryPerformAction("withdraw"))
if (!client.getFloodProtectors().canPerformTransaction())
{
player.sendMessage("You are withdrawing items too fast.");
return;

View File

@ -46,7 +46,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;

View File

@ -72,7 +72,7 @@ public class UseItem implements IClientIncomingPacket
}
// Flood protect UseItem
if (!client.getFloodProtectors().getUseItem().tryPerformAction("use item"))
if (!client.getFloodProtectors().canUseItem())
{
return;
}

View File

@ -59,7 +59,7 @@ public class RequestCrystallizeEstimate implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -41,7 +41,7 @@ public class RequestCrystallizeItemCancel implements IClientIncomingPacket
return;
}
// if (!client.getFloodProtectors().getTransaction().tryPerformAction("crystallize"))
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;

View File

@ -82,10 +82,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().canOverrideCond(PlayerCondOverride.FLOOD_CONDITIONS))
{
@ -97,7 +96,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;
}

View File

@ -25,73 +25,20 @@ 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;
/**
* 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;
/**
* Send mail flood protector.
*/
private final FloodProtectorAction _sendMail;
/**
* Character Select protector
*/
private final FloodProtectorAction _characterSelect;
/**
* Item Auction
*/
private final FloodProtectorAction _itemAuction;
/**
* Player Action
*/
private final FloodProtectorAction _playerAction;
/**
@ -103,7 +50,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);
@ -113,162 +59,84 @@ 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);
_sendMail = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SENDMAIL);
_characterSelect = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_CHARACTER_SELECT);
_itemAuction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ITEM_AUCTION);
_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 canUseServerBypass()
{
return _dropItem;
return _serverBypass.canPerformAction();
}
/**
* Returns {@link #_serverBypass}.
* @return {@link #_serverBypass}
*/
public FloodProtectorAction getServerBypass()
public boolean canUseMultiSell()
{
return _serverBypass;
return _multiSell.canPerformAction();
}
/**
* @return {@link #_multiSell}
*/
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 canSendMail()
{
return _manufacture;
return _sendMail.canPerformAction();
}
/**
* Returns {@link #_manor}.
* @return {@link #_manor}
*/
public FloodProtectorAction getManor()
public boolean canSelectCharacter()
{
return _manor;
return _characterSelect.canPerformAction();
}
/**
* Returns {@link #_sendMail}.
* @return {@link #_sendMail}
*/
public FloodProtectorAction getSendMail()
public boolean canUseItemAuction()
{
return _sendMail;
return _itemAuction.canPerformAction();
}
/**
* Returns {@link #_characterSelect}.
* @return {@link #_characterSelect}
*/
public FloodProtectorAction getCharacterSelect()
public boolean canPerformPlayerAction()
{
return _characterSelect;
}
/**
* Returns {@link #_itemAuction}.
* @return {@link #_itemAuction}
*/
public FloodProtectorAction getItemAuction()
{
return _itemAuction;
}
/**
* Returns {@link #_playerAction}.
* @return {@link #_playerAction}
*/
public FloodProtectorAction getPlayerAction()
{
return _playerAction;
return _playerAction.canPerformAction();
}
}

View File

@ -24,13 +24,6 @@ FloodProtectorRollDicePunishmentLimit = 0
FloodProtectorRollDicePunishmentType = none
FloodProtectorRollDicePunishmentTime = 0
# Firework - firework flooding
FloodProtectorFireworkInterval = 42
FloodProtectorFireworkLogFlooding = False
FloodProtectorFireworkPunishmentLimit = 0
FloodProtectorFireworkPunishmentType = none
FloodProtectorFireworkPunishmentTime = 0
# ItemPetSummon - item summoning and pet mounting flooding
FloodProtectorItemPetSummonInterval = 16
FloodProtectorItemPetSummonLogFlooding = False
@ -94,13 +87,6 @@ FloodProtectorManufacturePunishmentLimit = 0
FloodProtectorManufacturePunishmentType = none
FloodProtectorManufacturePunishmentTime = 0
# Manor
FloodProtectorManorInterval = 30
FloodProtectorManorLogFlooding = False
FloodProtectorManorPunishmentLimit = 0
FloodProtectorManorPunishmentType = none
FloodProtectorManorPunishmentTime = 0
# SendMail - sending mail interval, 10s on retail
FloodProtectorSendMailInterval = 100
FloodProtectorSendMailLogFlooding = False

View File

@ -72,7 +72,7 @@ public class ItemAuctionLink implements IBypassHandler
final String cmd = st.nextToken();
if ("show".equalsIgnoreCase(cmd))
{
if (!player.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
if (!player.getClient().getFloodProtectors().canUseItemAuction())
{
return false;
}

Some files were not shown because too many files have changed in this diff Show More