Jump to content
  • 0

Not allow dual box in some areas


Question

Posted

I need not to allow dual box in some zones, specifically in RB zones, any idea how to do it?

 

if anyone has any code that can help me, much better

 

Thank!

1 answer to this question

Recommended Posts

  • 0
Posted (edited)
21 hours ago, hasl said:

I need not to allow dual box in some zones, specifically in RB zones, any idea how to do it?

 

if anyone has any code that can help me, much better

 

Thank!

 

If you want a specific zone you simply go on it's onEnter() overriden method and make a check for IP. 

The check can be a boolean method such as:

 

private boolean isAllowed(final L2Character character)
{
	if (!character.isPlayer())
	{
		return true;
	}
		
	return getCharactersInside().stream().filter(s -> s.isPlayer()).anyMatch(s -> s.getActingPlayer().getIPAddress().equals(character.getActingPlayer().getIPAddress()));
}

 

Now if you want to apply this in multiple zone instead of 1 you need find (in L2J Case)

 

public void revalidateZones(final L2Character character)
{
	if (character.isTeleporting())
	{
		return;
	}

	for (final L2ZoneType zone : getZones())
	{
		if (zone != null)
		{
			zone.revalidateInZone(character);
		}
	}
}

 

and inside the check before 

 

zone.revalidateInZone(character);

 

you need to add this boolean custom check and teleport player in nearest town or do any further action you want.

 

Consider the code i gave you and the examples are from L2J written in java JDK 8+

Edited by Kara
Guest
This topic is now closed to further replies.
×
×
  • Create New...