Guest User

Untitled

a guest
Oct 19th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. L2PartyZone.java
  2.  
  3. /* L2jFrozen Project - www.l2jfrozen.com
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  18. * 02111-1307, USA.
  19. *
  20. * http://www.gnu.org/copyleft/gpl.html
  21. */
  22. package com.l2jfrozen.gameserver.model.zone.type;
  23.  
  24. import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
  25. import com.l2jfrozen.gameserver.model.L2Character;
  26. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  27. import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  28.  
  29. import javolution.util.FastList;
  30.  
  31. import com.l2jfrozen.gameserver.model.L2Party;
  32.  
  33. public class L2PartyZone extends L2ZoneType
  34. {
  35.  
  36. public L2PartyZone (int id)
  37. {
  38. super (id);
  39. }
  40.  
  41.  
  42. @Override
  43. protected void onEnter (L2Character character)
  44. {
  45. if (character instanceof L2PcInstance)
  46. {
  47. if (character.getParty()!= null)
  48. {
  49. ((L2PcInstance) character) .setIsInsidePartyZone (true);
  50. ((L2PcInstance) character) .sendMessage ("You have entered Party Zone. Prepare for fight.");
  51. }
  52. else
  53. {
  54. ((L2PcInstance) character) .sendMessage ("This is strict area for Party Members ONLY. You will be teleported at the nearest town.");
  55. ((L2PcInstance) character) .teleToLocation (MapRegionTable.TeleportWhereType.Town);
  56. }
  57. }
  58. }
  59.  
  60. @Override
  61. protected void onExit (L2Character character)
  62. {
  63. if (character instanceof L2PcInstance)
  64. {
  65. ((L2PcInstance) character) .setIsInsidePartyZone (false);
  66. ((L2PcInstance) character) .sendMessage ("You have Left Party Zone.");
  67. }
  68. }
  69.  
  70.  
  71. @Override
  72. public void onDieInside (L2Character character)
  73. {
  74.  
  75. }
  76.  
  77. @Override
  78. public void onReviveInside (L2Character character)
  79. {
  80. onEnter (character);
  81. }
  82. }
  83.  
  84. ====================================
  85. L2Party.Java
  86. ===================================
  87.  
  88. /**
  89. * Remove player from party
  90. * @param player
  91. */
  92. public void removePartyMember(final L2PcInstance player)
  93. {
  94. removePartyMember(player, true);
  95.  
  96. if (player.isInsideZone(L2Character.ZONE_PARTYZONE) && player.isInParty)
  97. {
  98. if(player.getPartyMembers() < 5){
  99. player.sendMessage("Come back when you have the proper party numbers.");
  100. getPartyMembers().forEach(s -> s.teleToLocation(MapRegionTable.TeleportWhereType.Town));
  101. return;
  102. }
  103. }else if(player.isInParty){
  104. player.sendMessage("You can't stay inside party zone without party!");
  105. player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  106. return;
  107. }
  108. }
Add Comment
Please, Sign In to add comment