L2SiegeClan.java 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.model;
  20. import java.util.List;
  21. import java.util.concurrent.CopyOnWriteArrayList;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. public class L2SiegeClan
  24. {
  25. private int _clanId = 0;
  26. private final List<L2Npc> _flag = new CopyOnWriteArrayList<>();
  27. private SiegeClanType _type;
  28. public enum SiegeClanType
  29. {
  30. OWNER,
  31. DEFENDER,
  32. ATTACKER,
  33. DEFENDER_PENDING
  34. }
  35. public L2SiegeClan(int clanId, SiegeClanType type)
  36. {
  37. _clanId = clanId;
  38. _type = type;
  39. }
  40. public int getNumFlags()
  41. {
  42. return _flag.size();
  43. }
  44. public void addFlag(L2Npc flag)
  45. {
  46. _flag.add(flag);
  47. }
  48. public boolean removeFlag(L2Npc flag)
  49. {
  50. boolean ret = _flag.remove(flag);
  51. flag.deleteMe();
  52. return ret;
  53. }
  54. public void removeFlags()
  55. {
  56. _flag.forEach(f -> f.decayMe());
  57. _flag.clear();
  58. }
  59. public final int getClanId()
  60. {
  61. return _clanId;
  62. }
  63. public final List<L2Npc> getFlag()
  64. {
  65. return _flag;
  66. }
  67. public SiegeClanType getType()
  68. {
  69. return _type;
  70. }
  71. public void setType(SiegeClanType setType)
  72. {
  73. _type = setType;
  74. }
  75. }