Jump to content
  • 0

Help TownManager aCis


l2jkain
 Share

Question

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;
    }

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
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
Link to comment
Share on other sites

  • 0

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);

 

Link to comment
Share on other sites

  • 0
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;
}

 

   

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

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

 Share



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