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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Posts

    • @Mobius I only asked you one question! All your previous versions are sh*t and the last version is the best ? Because this is what you said.
    • Close that LOLserver. And change name to L2Wipe&Money.
    • Open Beta January 17th & 21:00 UTC +2 Launch Date January 24th & 21:00 UTC +2 Click Here to Explore Vanilla Gracia Final Low-Rate Server. Join our Discord Community     Following the success of our Vanilla project, we decided to launch it again as Last PlayINERA’s Server! Core Settings *Vanilla will have Strict Botting & Client Limitation Rules and Chronicle Progression from Gracia Final to Gracia Epilogue to H5 in Long term! XP: x4 SP: x4 Adena: x2 Drop: x2 Spoil: x3 Manor: x0.4 (60% reduction) - Festive sweeper enabled! Seal Stones: x2 Herbs: x1 Safe Enchant: +3 Maximum Enchant: Retail Enchant Rate: Dynamic General Settings Auto-loot Can be toggled Buffs Adventurer Guide buffs are free, retail level limit removed. Buff Slots: 20 (+ 4) Summon buffs will remain on re-summoning & on death while Noblesse blessing is applied! (Olympiad excluded) Pet buffs will be saved on relog but not during summon/unsummon. Event Buffer [NEW] Event Buffer is enabled and will spawn randomly between 18:00 ~ 23:00 in Giran for 10 minutes, it will apply Farm Only buffs that are cancelled in PvP, Siege / Epic PvP zones & while in a chaotic state! Duration: 1-hour! Territory Wars every two weeks on Saturday. Castle sieges every two weeks on Sunday Class Transfer 1st Class Transfer: Available for purchase with either Adena or iCoin 2nd Class Transfer: Available for purchase with either Adena or iCoin 3rd Class Transfer: Quest or iCoin (the 3rd class transfer will become available for purchase with iCoin as soon as someone has entered the Hall of Fame for completing the 3rd class transfer quest for the class in question) Hellbound Hellbound Lv. 0-6: ATOD x1 Hellbound Lv. 7-12: ATOD x2 Tiat & Ekimus will become available at Stage 12 Hellbound can only be leveled up by killing monsters. No quests or raids are needed To open Hellbound, a party must kill Baylor in the Crystal Caverns The following items are now tradable: Ancient Tome of the Demon  Hidden First Page  Hidden Second Page  Demon Contract Fragment INERA Hub Library Clan Recruitment System Options Services Milestone Rewards Earn rewards for reaching various daily/one-time goals Client Limit: 1 (+1 with Standard Premium) Shift + Click Information on Monsters SP are required to learn new skills Offline shops Lasts for 15 days Olympiad Olympiad period: 1st and 15th day of the month (14th & Last day of month is the last day) 3 Vs. 3 match disabled Class-based matches will be held over the weekends One registration per HWID (PC) Minimum participants: 9 Party Matching System Earn bonuses for finding a group via the Party Matching system Vote Reward System World Chat No limits for first day! Available from level 20 Raid Bosses Epic Raid Boss zones will turn into a PvP zone while the Epic Raid Boss is alive ( + means Random) Server will start with all grand raids dead. Normal Raids: 12h (+6 hours random). Subclass raids, respawn 12h (+6 hours random). Noblesse Barakiel 12h (+6 hours random, PvP zone). Anakim & Lilith are static 24 hours respawn. Queen Ant: 24 hours (+2 hours random). Core: 40 hours (+2 hours random). Orfen: 32 hours (+2 hours random). Antharas Respawn: 8 Days. Randomly spawns at 19:00 ~ 21:00 Boosted to level 83 on Hellbound stage 7. Valakas Respawn: 10 Days. Randomly spawns at 19:00 ~ 21:00 Baium Respawn: 5 Days. Randomly spawns at 21:00 ~ 23:00 Boosted to level 83 on Hellbound stage 7. Frintezza Respawn: 2 Days. Randomly spawns at 21:00 ~ 23:00 Instanced Zaken Zaken (Day): Monday, Wednesday, Friday at 6:30. Zaken (Day): 9 players, LvL 55-65, 1hr max. Zaken (Night): Wednesday at 6:30 Zaken (Night): 18-45 players, LvL 55-65, 6hr max. Tiat: Saturday at 6:30, 18-36 players, 2 hrs max. Boosted to level 85. Ekimus: 24h at 6:30, 18-27 players, 1hr max. Tully’s Workshop (Darion & Tully): 24h +-1h. Tower of Naia (Beleth): 5 days, 18 min. & 36 max.
  • Topics

×
×
  • Create New...