Jump to content

[Guide]L2j IT Flood Protectors: Configuring, Adding, Learning.


Recommended Posts

Posted

Well, hello everybody!

Lately, as I was making my AIO topic, I've seen many FloodProtections for a few clientpackets.

Well, I thought that it's useless to search for FloodProtectors one by one, if you are able to create your own!

In this guide, we will learn how to create a FloodProtector, how to make the value configurable, what FloodProtectors are and a few more things!

Pay attention to this: Today we will talk for the L2jIT Flood Protector, so if you are using any kind of l2jfree, you can't follow this guide. And also, if you are using l2j G Final, you can get some advice, but you can't follow the guide!

Are you ready? ;-)

 

Introduction

 

The FloodProtectors (IT always) are a quite easy way to protect your server from unwanted floods or attacks.

It is not the best way to protect your server from hacks and exploits, although it's an easy one and almost everyone can (or at least will be able to) create.

The FloodProtectors set a delay for the actions to be done.

For example, by floodprotecting multisell with 10 secs delay, you simply stop players by buying stuff, if 10 seconds don't pass.

Quite easy, right?

 

 

The IT Flood Protector

 

Well, the FloodProtector file is located at net.sf.l2j.gameserver.util and is named FloodProtector.java

 

I will not start talking on how to floodprotect files in the normal way, cuz I promised you to show how to make them configurable.

 

Sooo..

 

Configuring

 

Well, we will start by creating our Properties File.

So, go at your configs and create a file named FloodProtector.properties (or any other name you want)

Add any description if you want, but don't forget the "#" symbol at the start of each line.

Then, copy paste these:

# FloodProtected UseItem
ProtectedUseItem = 4

# FloodProtected RollDice
ProtectedRollDice = 42

# FloodProtected Firework
ProtectedFireWork = 42

# FloodProtected Item / Pet Summon
ProtectedItemPetSummon = 16

# FloodProtected Hero Voice
ProtectedHeroVoice = 100

 

Now, let's register the new Config file at our GS.

 

Go at net/sf/l2j/Config.java and find the following line:

public static final String  L2JMOD_CONFIG_FILE            = "./config/l2jmods.properties";

It is about at line 64

 

Under this, add this line

public static final String  FLOODPROTECTOR_CONFIG_FILE  = "./config/FloodProtector.properties";

 

Now let's find another line

public static int L2JMOD_WEDDING_DIVORCE_COSTS;

This line's number is 800++

 

Now, create a new line, leave it empty, and create a few more lines, where you will add these things. Just copy/paste them, as I have them:

/** FloodProtector - Start */
public static int       PROTECTED_USEITEM; 
public static int       PROTECTED_ROLLDICE; 
public static int       PROTECTED_FIREWORK; 
public static int       PROTECTED_ITEMPETSUMMON; 
public static int       PROTECTED_HEROVOICE; 
/** FloodProtector - End */

 

Last step is to find this line

// pvp config

Which is line near 2000+

 

Above this line, you have to copy paste the following stuff (Don't leave any empty lines, they are not needed).

// Actions FloodProtector
        try
	 {
	      Properties FloodProtector   = new Properties();
	      InputStream is        = new FileInputStream(new File(FLOODPROTECTOR_CONFIG_FILE));
	      FloodProtector.load(is);
	      is.close();

	     PROTECTED_USEITEM        = Integer.parseInt(FloodProtector.getProperty("ProtectedUseItem", "4"));
            PROTECTED_ROLLDICE       = Integer.parseInt(FloodProtector.getProperty("ProtectedRollDice", "42"));
            PROTECTED_FIREWORK       = Integer.parseInt(FloodProtector.getProperty("ProtectedFireWork", "42"));
            PROTECTED_ITEMPETSUMMON  = Integer.parseInt(FloodProtector.getProperty("ProtectedItemPetSummon", "16"));
     PROTECTED_HEROVOICE      = Integer.parseInt(FloodProtector.getProperty("ProtectedHeroVoice", "100"));
                                 
}  
	catch (Exception e)  
{  
      e.printStackTrace();  
      throw new Error("Failed to Load "+FLOODPROTECTOR_CONFIG_FILE+" File.");  
}

 

Remember, that the values there, are the values that you have set as default at your config file!

 

Okay, now let's move on the FloodProtector.java file, in order to make some changes, since we have added a config file!

 

Open the file and find line 53

private static final int[] REUSEDELAY = new int[]{ 4, 42, 42, 16, 100 };

 

Delete this line, and then copy/paste the following:

private static final int[] REUSEDELAY = new int[]  
       {   
	     Config.PROTECTED_USEITEM, Config.PROTECTED_ROLLDICE, Config.PROTECTED_FIREWORK,  
	     Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE
	};

 

And that's it!

You have now your FloodProtector config file!

Let's move to the next part

 

 

Flood Protecting an Action

 

Well, everything's fine with the default protected actions.

But what's going on when we have to protect our own action? ;)

In this guide I will show you how to protect the multisell actions.

Although you can protect many other actions as well.

Let's start by adding it at our config file:

 

Open the config and add these

# FloodProtected Multisell
ProtectedMultisell = 4

 

Now, let's add them at Config.java!

Open it and find line 2000+

PROTECTED_HEROVOICE      = Integer.parseInt(FloodProtector.getProperty("ProtectedHeroVoice", "100"));

After this line, add this:

PROTECTED_MULTISELL      = Integer.parseInt(FloodProtector.getProperty("ProtectedMultisell", "4"));

 

And you're done with this file as well.

Let's move on the FloodProtector.java file!

 

Open it and find line 57

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE

 

Delete this line, and add this in its position

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE, Config.PROTECTED_MULTISELL

 

And then, find the line 65

public static final int PROTECTED_HEROVOICE             = 4;

 

And under this line add this:

public static final int PROTECTED_MULTISELL                     = 5;

 

Okay we are done with this as well!

The last step is to protect the specified action!

We open the proper clientpacket first (in our case it is MultiSellChoose.java)

 

Then, we add the FloodProtector java file at the imports:

import net.sf.l2j.gameserver.util.FloodProtector;

 

And last, we must find the proper place to add the code.

In this case search for line

if(player == null) return;

which is line 70++

Then we leave an empty line and, under the empty line we add our code!

if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_MULTISELL))  
	{  
	    player.sendMessage("You Can't Buy Items so Fast! Try again!");  
	    return;  
	}

 

 

And that's how we floodprotected one more action! ;)

Now, if you study a bit these steps, you will be able to add many floodprotections at many packets!

As I told, it's a quite nice way to protect your server (even if it's not the best).

 

 

Credits & BBs

 

Well, First of all I would like to thank my teacher Intrepid who started teaching me a few things.

Also, I would like to say that this guide was created by me, so all the credits go to me.

If you want to leech it, then I'll rape you :)

 

Best Regards,

Coyote.

Posted

Thanks everybody, glad that it helps you :)

And I am quite happy to receive this comment from Stef.

 

Today I will correct any little mistakes, cuz I made this guide yesterday night at 2:30 =P

Posted

You Have One Mistake My Friend...There You Puted  Somewhere In The Middle

 

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE, Config.PROTECTED_SUBCLASS

 

It Should Be

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE, Config.PROTECTED_MULTISELL

Posted

You Have One Mistake My Friend...There You Puted  Somewhere In The Middle

 

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE, Config.PROTECTED_SUBCLASS

 

It Should Be

Config.PROTECTED_ITEMPETSUMMON, Config.PROTECTED_HEROVOICE, Config.PROTECTED_MULTISELL

 

yes, you're right xD

Take a look at the time when I made this guide, and you'll understand why =P

Anyway, thanks for reporting it!

  • 3 weeks later...
Posted

hhmmm... sorry for the question but doesnt l2j includes floodprotection like this one :S ?

 

Only the Gracia Final L2j Project.

The Interlude floodprotectors - the ones I am talking about - need rework.

There are not even configurations about floodprotectors.

So, this is a nice way to start using them configurable.

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Tell a Škoda 1.4 driver that a Škoda 1.8 is faster — and suddenly, you’re riding a mini race car. On the way, they might share random stories — gas prices, the perfect BBQ recipe, or how passengers once called them “just for a minute.” Maybe even how someone left a suitcase full of money in their car once.     The important part? You’ll get there on time, no delays.     Vibe SMS works just as fast — messages fly like that driver who just heard their 1.8 isn’t the fastest.     🌐 https://vibe-sms.net/ 📲 https://t.me/vibe_sms  
    • ⚔️ The Grand Opening Has Arrived! ⚔️ In just a few hours the gate to the eternal battlefield will be open and the war between Order and Chaos will be set once again ! Its time to claim your destiny 🔥 👉 Register now and join the fight today! 🌐 https://l2ovc.com register now : https://l2ovc.com The gates are open the war between Order and Chaos has officially started! 🔥 Join the battlefield NOW and claim your destiny in Order vs Chaos! 💥 Don’t fall behind your faction needs you. ➡️ https://l2ovc.com  
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock