ArenaManager.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 net.sf.l2j.gameserver.instancemanager;
  16. import java.util.logging.Logger;
  17. import javolution.util.FastList;
  18. import net.sf.l2j.gameserver.model.L2Character;
  19. import net.sf.l2j.gameserver.model.zone.type.L2ArenaZone;
  20. public class ArenaManager
  21. {
  22. protected static final Logger _log = Logger.getLogger(ArenaManager.class.getName());
  23. // =========================================================
  24. private static ArenaManager _instance;
  25. public static final ArenaManager getInstance()
  26. {
  27. if (_instance == null)
  28. {
  29. _log.info("Initializing ArenaManager");
  30. _instance = new ArenaManager();
  31. }
  32. return _instance;
  33. }
  34. // =========================================================
  35. // =========================================================
  36. // Data Field
  37. private FastList<L2ArenaZone> _arenas;
  38. // =========================================================
  39. // Constructor
  40. public ArenaManager()
  41. {
  42. }
  43. // =========================================================
  44. // Property - Public
  45. public void addArena(L2ArenaZone arena)
  46. {
  47. if (_arenas == null)
  48. _arenas = new FastList<L2ArenaZone>();
  49. _arenas.add(arena);
  50. }
  51. public final L2ArenaZone getArena(L2Character character)
  52. {
  53. for (L2ArenaZone temp : _arenas)
  54. if (temp.isCharacterInZone(character)) return temp;
  55. return null;
  56. }
  57. }