ZoneManager.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.instancemanager;
  16. import gnu.trove.TObjectProcedure;
  17. import java.io.File;
  18. import java.lang.reflect.Constructor;
  19. import java.util.Collection;
  20. import java.util.Iterator;
  21. import java.util.List;
  22. import java.util.Map;
  23. import java.util.logging.Level;
  24. import java.util.logging.Logger;
  25. import javax.xml.parsers.DocumentBuilderFactory;
  26. import javolution.util.FastList;
  27. import javolution.util.FastMap;
  28. import org.w3c.dom.Document;
  29. import org.w3c.dom.NamedNodeMap;
  30. import org.w3c.dom.Node;
  31. import com.l2jserver.Config;
  32. import com.l2jserver.gameserver.model.L2ItemInstance;
  33. import com.l2jserver.gameserver.model.L2Object;
  34. import com.l2jserver.gameserver.model.L2World;
  35. import com.l2jserver.gameserver.model.L2WorldRegion;
  36. import com.l2jserver.gameserver.model.actor.L2Character;
  37. import com.l2jserver.gameserver.model.zone.L2ZoneRespawn;
  38. import com.l2jserver.gameserver.model.zone.L2ZoneType;
  39. import com.l2jserver.gameserver.model.zone.form.ZoneCuboid;
  40. import com.l2jserver.gameserver.model.zone.form.ZoneCylinder;
  41. import com.l2jserver.gameserver.model.zone.form.ZoneNPoly;
  42. import com.l2jserver.gameserver.model.zone.type.L2ArenaZone;
  43. import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
  44. import com.l2jserver.gameserver.model.zone.type.L2RespawnZone;
  45. import com.l2jserver.util.file.filter.XMLFilter;
  46. /**
  47. * This class manages the zones
  48. *
  49. * @author durgus
  50. */
  51. public class ZoneManager
  52. {
  53. private static final Logger _log = Logger.getLogger(ZoneManager.class.getName());
  54. //private final FastMap<Integer, L2ZoneType> _zones = new FastMap<Integer, L2ZoneType>();
  55. private final Map<Class<? extends L2ZoneType>, Map<Integer, ? extends L2ZoneType>> _classZones = new FastMap<Class<? extends L2ZoneType>, Map<Integer, ? extends L2ZoneType>>();
  56. private int _lastDynamicId = 300000;
  57. private List<L2ItemInstance> _debugItems;
  58. /**
  59. * @return
  60. */
  61. public static final ZoneManager getInstance()
  62. {
  63. return SingletonHolder._instance;
  64. }
  65. // =========================================================
  66. // Data Field
  67. // =========================================================
  68. // Constructor
  69. private ZoneManager()
  70. {
  71. load();
  72. }
  73. public void reload()
  74. {
  75. // int zoneCount = 0;
  76. // Get the world regions
  77. int count = 0;
  78. L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
  79. for (int x = 0; x < worldRegions.length; x++)
  80. {
  81. for (int y = 0; y < worldRegions[x].length; y++)
  82. {
  83. worldRegions[x][y].getZones().clear();
  84. count++;
  85. }
  86. }
  87. GrandBossManager.getInstance().getZones().clear();
  88. _log.info("Removed zones in " + count + " regions.");
  89. // Load the zones
  90. load();
  91. L2World.getInstance().forEachObject(new ForEachCharacterRevalidateZone());
  92. }
  93. private final class ForEachCharacterRevalidateZone implements TObjectProcedure<L2Object>
  94. {
  95. @Override
  96. public final boolean execute(final L2Object o)
  97. {
  98. if (o instanceof L2Character)
  99. ((L2Character) o).revalidateZone(true);
  100. return true;
  101. }
  102. }
  103. // =========================================================
  104. // Method - Private
  105. private final void load()
  106. {
  107. _log.info("Loading zones...");
  108. _classZones.clear();
  109. // Get the world regions
  110. L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
  111. // Load the zone xml
  112. try
  113. {
  114. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  115. factory.setValidating(false);
  116. factory.setIgnoringComments(true);
  117. final File dir = new File(Config.DATAPACK_ROOT, "data/zones");
  118. if (!dir.exists())
  119. {
  120. _log.config("Dir " + dir.getAbsolutePath() + " not exists");
  121. return;
  122. }
  123. File[] files = dir.listFiles(new XMLFilter());
  124. FastList<File> hash = new FastList<File>(files.length);
  125. for (File f : files)
  126. {
  127. // default file first
  128. if ("zone.xml".equalsIgnoreCase(f.getName()))
  129. hash.addFirst(f);
  130. else
  131. hash.add(f);
  132. }
  133. Document doc;
  134. NamedNodeMap attrs;
  135. Node attribute;
  136. String zoneName;
  137. int[][] coords;
  138. int zoneId, minZ, maxZ;
  139. String zoneType, zoneShape;
  140. for (File f : hash)
  141. {
  142. doc = factory.newDocumentBuilder().parse(f);
  143. for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
  144. {
  145. if ("list".equalsIgnoreCase(n.getNodeName()))
  146. {
  147. attrs = n.getAttributes();
  148. attribute = attrs.getNamedItem("enabled");
  149. if (attribute != null && !Boolean.parseBoolean(attribute.getNodeValue()))
  150. continue;
  151. for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  152. {
  153. if ("zone".equalsIgnoreCase(d.getNodeName()))
  154. {
  155. attrs = d.getAttributes();
  156. attribute = attrs.getNamedItem("id");
  157. if (attribute != null)
  158. zoneId = Integer.parseInt(attribute.getNodeValue());
  159. else
  160. zoneId = _lastDynamicId++;
  161. attribute = attrs.getNamedItem("name");
  162. if (attribute != null)
  163. zoneName = attribute.getNodeValue();
  164. else
  165. zoneName = null;
  166. attribute = attrs.getNamedItem("minZ");
  167. if (attribute != null)
  168. minZ = Integer.parseInt(attribute.getNodeValue());
  169. else
  170. {
  171. _log.warning("ZoneData: Missing minZ for zone: " + zoneId + " in file: " + f.getName());
  172. continue;
  173. }
  174. attribute = attrs.getNamedItem("maxZ");
  175. if (attribute != null)
  176. maxZ = Integer.parseInt(attribute.getNodeValue());
  177. else
  178. {
  179. _log.warning("ZoneData: Missing maxZ for zone: " + zoneId + " in file: " + f.getName());
  180. continue;
  181. }
  182. attribute = attrs.getNamedItem("type");
  183. if (attribute != null)
  184. zoneType = attribute.getNodeValue();
  185. else
  186. {
  187. _log.warning("ZoneData: Missing type for zone: " + zoneId + " in file: " + f.getName());
  188. continue;
  189. }
  190. attribute = attrs.getNamedItem("shape");
  191. if (attribute != null)
  192. zoneShape = attribute.getNodeValue();
  193. else
  194. {
  195. _log.warning("ZoneData: Missing shape for zone: " + zoneId + " in file: " + f.getName());
  196. continue;
  197. }
  198. // Create the zone
  199. Class<?> newZone;
  200. try
  201. {
  202. newZone = Class.forName("com.l2jserver.gameserver.model.zone.type.L2" + zoneType);
  203. }
  204. catch (ClassNotFoundException e)
  205. {
  206. _log.warning("ZoneData: No such zone type: " + zoneType + " in file: " + f.getName());
  207. continue;
  208. }
  209. Constructor<?> zoneConstructor = newZone.getConstructor(int.class);
  210. L2ZoneType temp = (L2ZoneType) zoneConstructor.newInstance(zoneId);
  211. // Get the zone shape from sql
  212. try
  213. {
  214. coords = null;
  215. int[] point;
  216. FastList<int[]> rs = FastList.newInstance();
  217. try
  218. {
  219. // loading from XML first
  220. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  221. {
  222. if ("node".equalsIgnoreCase(cd.getNodeName()))
  223. {
  224. attrs = cd.getAttributes();
  225. point = new int[2];
  226. point[0] = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
  227. point[1] = Integer.parseInt(attrs.getNamedItem("Y").getNodeValue());
  228. rs.add(point);
  229. }
  230. }
  231. coords = rs.toArray(new int[rs.size()][]);
  232. }
  233. finally
  234. {
  235. FastList.recycle(rs);
  236. }
  237. if (coords == null || coords.length == 0)
  238. {
  239. _log.warning("ZoneData: missing data for zone: " + zoneId +" in both XML and SQL, file: " + f.getName());
  240. continue;
  241. }
  242. // Create this zone. Parsing for cuboids is a
  243. // bit different than for other polygons
  244. // cuboids need exactly 2 points to be defined.
  245. // Other polygons need at least 3 (one per
  246. // vertex)
  247. if (zoneShape.equalsIgnoreCase("Cuboid"))
  248. {
  249. if (coords.length == 2)
  250. temp.setZone(new ZoneCuboid(coords[0][0], coords[1][0], coords[0][1], coords[1][1], minZ, maxZ));
  251. else
  252. {
  253. _log.warning("ZoneData: Missing cuboid vertex in sql data for zone: " + zoneId + " in file: " + f.getName());
  254. continue;
  255. }
  256. }
  257. else if (zoneShape.equalsIgnoreCase("NPoly"))
  258. {
  259. // nPoly needs to have at least 3 vertices
  260. if (coords.length > 2)
  261. {
  262. final int[] aX = new int[coords.length];
  263. final int[] aY = new int[coords.length];
  264. for (int i = 0; i < coords.length; i++)
  265. {
  266. aX[i] = coords[i][0];
  267. aY[i] = coords[i][1];
  268. }
  269. temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ));
  270. }
  271. else
  272. {
  273. _log.warning("ZoneData: Bad data for zone: " + zoneId + " in file: " + f.getName());
  274. continue;
  275. }
  276. }
  277. else if (zoneShape.equalsIgnoreCase("Cylinder"))
  278. {
  279. // A Cylinder zone requires a center point
  280. // at x,y and a radius
  281. attrs = d.getAttributes();
  282. final int zoneRad = Integer.parseInt(attrs.getNamedItem("rad").getNodeValue());
  283. if (coords.length == 1 && zoneRad > 0)
  284. temp.setZone(new ZoneCylinder(coords[0][0], coords[0][1], minZ, maxZ, zoneRad));
  285. else
  286. {
  287. _log.warning("ZoneData: Bad data for zone: " + zoneId + " in file: " + f.getName());
  288. continue;
  289. }
  290. }
  291. else
  292. {
  293. _log.warning("ZoneData: Unknown shape: " + zoneShape + " in file: " + f.getName());
  294. continue;
  295. }
  296. }
  297. catch (Exception e)
  298. {
  299. _log.log(Level.WARNING, "ZoneData: Failed to load zone " + zoneId + " coordinates: " + e.getMessage(), e);
  300. }
  301. // Check for additional parameters
  302. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  303. {
  304. if ("stat".equalsIgnoreCase(cd.getNodeName()))
  305. {
  306. attrs = cd.getAttributes();
  307. String name = attrs.getNamedItem("name").getNodeValue();
  308. String val = attrs.getNamedItem("val").getNodeValue();
  309. temp.setParameter(name, val);
  310. }
  311. else if ("spawn".equalsIgnoreCase(cd.getNodeName()) && temp instanceof L2ZoneRespawn)
  312. {
  313. attrs = cd.getAttributes();
  314. int spawnX = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
  315. int spawnY = Integer.parseInt(attrs.getNamedItem("Y").getNodeValue());
  316. int spawnZ = Integer.parseInt(attrs.getNamedItem("Z").getNodeValue());
  317. Node val = attrs.getNamedItem("isOther");
  318. boolean other = val != null && Boolean.parseBoolean(val.getNodeValue());
  319. val = attrs.getNamedItem("isChaotic");
  320. boolean chaotic = val != null && Boolean.parseBoolean(val.getNodeValue());
  321. val = attrs.getNamedItem("isBanish");
  322. boolean banish = val != null && Boolean.parseBoolean(val.getNodeValue());
  323. if (other)
  324. ((L2ZoneRespawn) temp).addOtherSpawn(spawnX, spawnY, spawnZ);
  325. else if (chaotic)
  326. ((L2ZoneRespawn) temp).addChaoticSpawn(spawnX, spawnY, spawnZ);
  327. else if (banish)
  328. ((L2ZoneRespawn) temp).addBanishSpawn(spawnX, spawnY, spawnZ);
  329. else
  330. ((L2ZoneRespawn) temp).addSpawn(spawnX, spawnY, spawnZ);
  331. }
  332. else if ("race".equalsIgnoreCase(cd.getNodeName()) && temp instanceof L2RespawnZone)
  333. {
  334. attrs = cd.getAttributes();
  335. String race = attrs.getNamedItem("name").getNodeValue();
  336. String point = attrs.getNamedItem("point").getNodeValue();
  337. ((L2RespawnZone) temp).addRaceRespawnPoint(race, point);
  338. }
  339. }
  340. if (checkId(zoneId))
  341. _log.config("Caution: Zone (" + zoneId + ") from file: " + f.getName() + " overrides previos definition.");
  342. if (zoneName != null && !zoneName.isEmpty())
  343. temp.setName(zoneName);
  344. addZone(zoneId, temp);
  345. // Register the zone into any world region it
  346. // intersects with...
  347. // currently 11136 test for each zone :>
  348. int ax, ay, bx, by;
  349. for (int x = 0; x < worldRegions.length; x++)
  350. {
  351. for (int y = 0; y < worldRegions[x].length; y++)
  352. {
  353. ax = (x - L2World.OFFSET_X) << L2World.SHIFT_BY;
  354. bx = ((x + 1) - L2World.OFFSET_X) << L2World.SHIFT_BY;
  355. ay = (y - L2World.OFFSET_Y) << L2World.SHIFT_BY;
  356. by = ((y + 1) - L2World.OFFSET_Y) << L2World.SHIFT_BY;
  357. if (temp.getZone().intersectsRectangle(ax, bx, ay, by))
  358. {
  359. if (Config.DEBUG)
  360. {
  361. _log.info("Zone (" + zoneId + ") added to: " + x + " " + y);
  362. }
  363. worldRegions[x][y].addZone(temp);
  364. }
  365. }
  366. }
  367. }
  368. }
  369. }
  370. }
  371. }
  372. }
  373. catch (Exception e)
  374. {
  375. _log.log(Level.SEVERE, "Error while loading zones.", e);
  376. return;
  377. }
  378. _log.info("Done: loaded " + _classZones.size() + " zone classes and "+getSize()+" zones.");
  379. }
  380. public int getSize()
  381. {
  382. int i = 0;
  383. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  384. {
  385. i += map.size();
  386. }
  387. return i;
  388. }
  389. public boolean checkId(int id)
  390. {
  391. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  392. {
  393. if (map.containsKey(id))
  394. return true;
  395. }
  396. return false;
  397. }
  398. /**
  399. * Add new zone
  400. * @param <T>
  401. * @param id
  402. * @param zone
  403. */
  404. @SuppressWarnings("unchecked")
  405. public <T extends L2ZoneType> void addZone(Integer id, T zone)
  406. {
  407. //_zones.put(id, zone);
  408. Map<Integer, T> map = (Map<Integer, T>) _classZones.get(zone.getClass());
  409. if (map == null)
  410. {
  411. map = new FastMap<Integer, T>();
  412. map.put(id, zone);
  413. _classZones.put(zone.getClass(), map);
  414. }
  415. else
  416. map.put(id, zone);
  417. }
  418. /**
  419. * Returns all zones registered with the ZoneManager.
  420. * To minimise iteration processing retrieve zones from L2WorldRegion for a specific location instead.
  421. * @return zones
  422. * @see #getAllZones(Class)
  423. */
  424. @Deprecated
  425. public Collection<L2ZoneType> getAllZones()
  426. {
  427. FastList<L2ZoneType> zones = new FastList<L2ZoneType>();
  428. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  429. {
  430. zones.addAll(map.values());
  431. }
  432. return zones;
  433. }
  434. /**
  435. * Return all zones by class type
  436. * @param <T>
  437. * @param zoneType Zone class
  438. * @return Collection of zones
  439. */
  440. @SuppressWarnings("unchecked")
  441. public <T extends L2ZoneType> Collection<T> getAllZones(Class<T> zoneType)
  442. {
  443. return (Collection<T>) _classZones.get(zoneType).values();
  444. }
  445. /**
  446. * Get zone by ID
  447. * @param id
  448. * @return
  449. * @see #getZoneById(int, Class)
  450. */
  451. public L2ZoneType getZoneById(int id)
  452. {
  453. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  454. {
  455. if (map.containsKey(id))
  456. return map.get(id);
  457. }
  458. return null;
  459. }
  460. /**
  461. * Get zone by ID and zone class
  462. * @param <T>
  463. * @param id
  464. * @param zoneType
  465. * @return zone
  466. */
  467. @SuppressWarnings("unchecked")
  468. public <T extends L2ZoneType> T getZoneById(int id, Class<T> zoneType)
  469. {
  470. return (T) _classZones.get(zoneType).get(id);
  471. }
  472. /**
  473. * Returns all zones from where the object is located
  474. *
  475. * @param object
  476. * @return zones
  477. */
  478. public FastList<L2ZoneType> getZones(L2Object object)
  479. {
  480. return getZones(object.getX(), object.getY(), object.getZ());
  481. }
  482. /**
  483. * @param <T>
  484. * @param object
  485. * @param type
  486. * @return zone from where the object is located by type
  487. */
  488. public <T extends L2ZoneType> T getZone(L2Object object, Class<T> type)
  489. {
  490. if (object == null)
  491. return null;
  492. return getZone(object.getX(), object.getY(), object.getZ(), type);
  493. }
  494. /**
  495. * Returns all zones from given coordinates (plane)
  496. *
  497. * @param x
  498. * @param y
  499. * @return zones
  500. */
  501. public FastList<L2ZoneType> getZones(int x, int y)
  502. {
  503. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  504. FastList<L2ZoneType> temp = new FastList<L2ZoneType>();
  505. for (L2ZoneType zone : region.getZones())
  506. {
  507. if (zone.isInsideZone(x, y))
  508. temp.add(zone);
  509. }
  510. return temp;
  511. }
  512. /**
  513. * Returns all zones from given coordinates
  514. *
  515. * @param x
  516. * @param y
  517. * @param z
  518. * @return zones
  519. */
  520. public FastList<L2ZoneType> getZones(int x, int y, int z)
  521. {
  522. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  523. FastList<L2ZoneType> temp = new FastList<L2ZoneType>();
  524. for (L2ZoneType zone : region.getZones())
  525. {
  526. if (zone.isInsideZone(x, y, z))
  527. temp.add(zone);
  528. }
  529. return temp;
  530. }
  531. /**
  532. * @param <T>
  533. * @param x
  534. * @param y
  535. * @param z
  536. * @param type
  537. * @return zone from given coordinates
  538. */
  539. @SuppressWarnings("unchecked")
  540. public <T extends L2ZoneType> T getZone(int x, int y, int z, Class<T> type)
  541. {
  542. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  543. for (L2ZoneType zone : region.getZones())
  544. {
  545. if (zone.isInsideZone(x, y, z) && type.isInstance(zone))
  546. return (T) zone;
  547. }
  548. return null;
  549. }
  550. public final L2ArenaZone getArena(L2Character character)
  551. {
  552. if (character == null)
  553. return null;
  554. for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
  555. {
  556. if (temp instanceof L2ArenaZone && temp.isCharacterInZone(character))
  557. return ((L2ArenaZone) temp);
  558. }
  559. return null;
  560. }
  561. public final L2OlympiadStadiumZone getOlympiadStadium(L2Character character)
  562. {
  563. if (character == null)
  564. return null;
  565. for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
  566. {
  567. if (temp instanceof L2OlympiadStadiumZone && temp.isCharacterInZone(character))
  568. return ((L2OlympiadStadiumZone) temp);
  569. }
  570. return null;
  571. }
  572. /**
  573. * For testing purposes only
  574. * @param <T>
  575. * @param obj
  576. * @param type
  577. * @return
  578. */
  579. @SuppressWarnings("unchecked")
  580. public <T extends L2ZoneType> T getClosestZone(L2Object obj, Class<T> type)
  581. {
  582. T zone = getZone(obj, type);
  583. if (zone == null)
  584. {
  585. double closestdis = Double.MAX_VALUE;
  586. for (T temp : (Collection<T>) _classZones.get(type).values())
  587. {
  588. double distance = temp.getDistanceToZone(obj);
  589. if (distance < closestdis)
  590. {
  591. closestdis = distance;
  592. zone = temp;
  593. }
  594. }
  595. }
  596. return zone;
  597. }
  598. /**
  599. * General storage for debug items used for visualizing zones.
  600. * @return list of items
  601. */
  602. public List<L2ItemInstance> getDebugItems()
  603. {
  604. if (_debugItems == null)
  605. _debugItems = new FastList<L2ItemInstance>();
  606. return _debugItems;
  607. }
  608. /**
  609. * Remove all debug items from l2world
  610. */
  611. public void clearDebugItems()
  612. {
  613. if (_debugItems != null)
  614. {
  615. Iterator<L2ItemInstance> it = _debugItems.iterator();
  616. while (it.hasNext())
  617. {
  618. L2ItemInstance item = it.next();
  619. if (item != null)
  620. item.decayMe();
  621. it.remove();
  622. }
  623. }
  624. }
  625. @SuppressWarnings("synthetic-access")
  626. private static class SingletonHolder
  627. {
  628. protected static final ZoneManager _instance = new ZoneManager();
  629. }
  630. }