Extension flood filter
Posted: 24 Jul 2023, 17:51
Hello, I am trying to implement the extension flood filter added in 2.19. Here is my code:
I have made sure that the extension is successfully compiling as well. No matter what I do on the client side, even hundreds of requests / second, the filter is not triggered and nothing is displayed serverside. On server boot I see "Extension AntiFlood Filter initialized" so I know it starts.
Code: Select all
static final String MOVEMENT_HANDLER = "move";
static final String TEST_HANDLER = "test";
public void init()
{
// Login and Sign-up process
initSignUpAssistant();
initLoginAssistant();
// Assign game handler
gameAPI = sfs.getAPIManager().getGameApi();
// Extension flood filter
ExtensionFloodFilterConfig cfg = new ExtensionFloodFilterConfig();
cfg.banDurationMinutes = 120;
cfg.maxFloodingAttempts = 3;
cfg.secondsBeforeBan = 2;
cfg.banMode = BanMode.BY_NAME;
cfg.logFloodingAttempts = true;
cfg.banMessage = "Banned for spam";
cfg.filterRules = Map.of
(
MOVEMENT_HANDLER, 1,
TEST_HANDLER, 15
);
initFloodFilter(cfg);
//Request handlers
addRequestHandler(MOVEMENT_HANDLER, MovementHandler.class);
addRequestHandler(TEST_HANDLER, TestHandler.class);
}