Jump to content
  • 0

Maximum 2 healers allowed in party


Question

Posted (edited)

Hello i try to make maximum 2 healers allowed in 1 party but im getting some problems maybe can someone help me ?

 

i added this lines to requestjoinparty but is not working properly

 

            if (target.getClassId().getId() == 97 && (party.getMembersCount() >= 2) ) 
                {
                    requestor.sendMessage("Maximum 2 healers are allowed in party !");
                    return;
                }

 

 

Edited by arm4729

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

Your "party.getMembersCount() >= 2" condition is for the party overall.
You need to store the healers at-invite and remove them at-leave, so you know they are actually in the party.

 

filter(player -> player.getClassId() == 97).size()

 

or

 

Fast and ugly for the sake of L2J:

 

private static final List<Player> HEALER_LIST = new ArrayList<>();

 

If player.getClassId == 97:

HEALES_LIST.add(player);

HEALER_LIST.remove(player);

 

You can use the condition If HEALER_LIST.size() >= 2 to forbid an amount and you don't need to check getClassId, because you already checked that at add/remove.

 

You also got this: for (Player healer : HEALER_LIST)

So you can do stuff with the healer while being in the party.

 

Make the player to leave party while changing subclasses.

Edited by Trance
  • 0
Posted
37 minutes ago, Trance said:

Your "party.getMembersCount() >= 2" condition is for the party overall.
You need to store the healers at-invite and remove them at-leave, so you know they are actually in the party.

 

private static final List<Player> HEALER_LIST = new ArrayList<>();

 

If player.getClassId == 97:

HEALES_LIST.add(player);

HEALER_LIST.remove(player);

 

You can use the condition If HEALER_LIST.size() >= 2 to forbid an amount and you don't need to check getClassId, because you already checked that at add/remove.

 

You also got this: for (Player healer : HEALER_LIST)

So you can do stuff with the healer while being in the party.

 

Make the player to leave party while changing subclasses.

Your code is unnecessary.

 

@arm4729

 

if (party.getMembers().stream().filter(k -> k.getClassId() == ClassId.bishop).count() > 2)
{
	// Failed to add		
}

 

  • 0
Posted (edited)
17 minutes ago, EdithFinch said:

Your code is unnecessary.

 

@arm4729

 


if (party.getMembers().stream().filter(k -> k.getClassId() == ClassId.bishop).count() > 2)
{
	// Failed to add		
}

 

 

I included that as well, edited before your reply, I had a feeling someone would take it more seriously.

Edited by Trance
  • 0
Posted (edited)

very thank you guys !!

 

i only tried this 

 

            if (party.getMembers().stream().filter(k -> k.getClassId() == (ClassId.CARDINAL)).count() >= 2)

 

is working fine thx

Edited by arm4729
Guest
This topic is now closed to further replies.


  • Posts

    • WTB Character on Lineage 2 Reborn - Origins 1x Server   Looking for lvl 80+ character (3 subclasses )+ clean email  Classes im mostly intrested about are: Mystic Muse Adventurer Ghost Hunter Soul Hound Grand Khavatari Titan   Im looking forward for your PM's here on Max website or leave a comment down below with your discord or any contact in case you have any of those classes. If you have any other class that are not mentioned drop a PM aswell might be intrested in other classes i haven't mentioned aswell if its high lvl and has good potential.
    • Thanks for showing us this post, it is clearly seen that some user names pulling hate in that post, have the same name here in maxcheaters.... it is very interesting information, as it shows that the same users here at maxcheaters are scouring other forum posts to spew their hate. this does not affect much, as the customers understand, that there are only 4 or 5 people globally trying to harm our project.... the rest are all happy, luckily 🙂   Greetings. PD: You still don't understand that this is going to spread to many servers and it's something you can't avoid... you understand that, don't you? By the way, if you used an extender like ours, maybe you wouldn't have to reopen your server hundreds of times over the years.
    • 🚨 L2MID RETURNS IN 2025! 🚨 After 3 long years… The wait is FINALLY over! One of the most legendary Lineage 2 server is coming back stronger, sharper, and more competitive than ever before. 💎 All users who vote will receive exclusive gifts in the future! 👉 Cast your vote now!  https://l2mid.com/vote/ Let’s make this the most epic comeback ever! Stay tuned for more updates and invite your friends L2Mid is BACK!
    • Yeah I also “heard” you are pretty popular over there 🙂 especially in Ukraine/RU   https://mmo-dev.info/threads/⭐-l2off-h5-gx-ext⭐.33144/
    • I do not disclose information about my clients 🙂 you will see them online for example, in brazil, argentina and chile. Have great sales.   Best regards.
  • 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