Jump to content
  • 0

Question

Posted

Hi, I'm adapting the Town Manager event for aCis. 

When I change this TownManager.getTown(Config.TW_TOWN_ID).setIsTWZone(true);

 

for 

ZoneManager.getInstance().getZoneById(i, TownZone.class).setIsTWZone(true);

 

generates the error

 

GSyA0X0.png

 

what did I do wrong ?

 

TownManager of jserver :

 

public static final L2TownZone getTown(int townId)
    {
        for (L2TownZone temp : ZoneManager.getInstance().getAllZones(L2TownZone.class))
        {
            if (temp.getTownId() == townId)
            {
                return temp;
            }
        }
        return null;
    }
    
    /**
     * Returns the town at that position (if any)
     * @param x
     * @param y
     * @param z
     * @return
     */
    public static final L2TownZone getTown(int x, int y, int z)
    {
        for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
        {
            if (temp instanceof L2TownZone)
            {
                return (L2TownZone) temp;
            }
        }
        return null;
    }

6 answers to this question

Recommended Posts

  • 0
Posted (edited)
6 minutes ago, melron said:

TownWarManager:106

 

106 

 

this TownManager.getTown(Config.TW_TOWN_ID).setIsTWZone(true);

 

for 

ZoneManager.getInstance().getZoneById(i, TownZone.class).setIsTWZone(true);

Edited by l2jkain
  • 0
Posted

what is 'i'? 

 

you could use a null check first...

final TownZone tempZone = ZoneManager.getInstance().getZoneById(i, TownZone.class);
if (tempZone != null)
	tempZone.setIsTWZone(true);
else
	System.out.println("Zone not found with id " + i);

 

  • 0
Posted
12 minutes ago, melron said:

what is 'i'? 

 

you could use a null check first...


final TownZone tempZone = ZoneManager.getInstance().getZoneById(i, TownZone.class);
if (tempZone != null)
	tempZone.setIsTWZone(true);
else
	System.out.println("Zone not found with id " + i);

 

 


 

I created a check in ZoneManager for all town zones and it worked perfectly,

this should work.

ZoneManager.getInstance (). GetZoneById (i, TownZone.class) .setIsTWZone (true)

I created this in ZoneManager


public TownZone getTown (int townId)
{
for (TownZone temp: ZoneManager.getInstance (). getAllZones (TownZone.class))
{
if (temp.getTownId () == townId)
return temp;
}
return null;
}

 

   

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
×
×
  • 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