Advertisement
CostyKiller

New cc leader same clan condition

Mar 12th, 2021
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.39 KB | None | 0 0
  1. Index: java/org/l2jmobius/gameserver/model/instancezone/conditions/ConditionCommandChannelLeaderSameClan.java
  2. ===================================================================
  3. --- java/org/l2jmobius/gameserver/model/instancezone/conditions/ConditionCommandChannelLeaderSameClan.java  (nonexistent)
  4. +++ java/org/l2jmobius/gameserver/model/instancezone/conditions/ConditionCommandChannelLeaderSameClan.java  (working copy)
  5. @@ -0,0 +1,51 @@
  6. +/*
  7. + * This file is part of the L2J Mobius project.
  8. + *
  9. + * This program is free software: you can redistribute it and/or modify
  10. + * it under the terms of the GNU General Public License as published by
  11. + * the Free Software Foundation, either version 3 of the License, or
  12. + * (at your option) any later version.
  13. + *
  14. + * This program is distributed in the hope that it will be useful,
  15. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. + * General Public License for more details.
  18. + *
  19. + * You should have received a copy of the GNU General Public License
  20. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. + */
  22. +package org.l2jmobius.gameserver.model.instancezone.conditions;
  23. +
  24. +import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
  25. +import org.l2jmobius.gameserver.model.StatSet;
  26. +import org.l2jmobius.gameserver.model.actor.Npc;
  27. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  28. +import org.l2jmobius.gameserver.model.instancezone.InstanceTemplate;
  29. +import org.l2jmobius.gameserver.network.SystemMessageId;
  30. +
  31. +/**
  32. + * Command channel leader same clan condition
  33. + * @author CostyKiller
  34. + */
  35. +public class ConditionCommandChannelLeaderSameClan extends Condition
  36. +{
  37. +   public ConditionCommandChannelLeaderSameClan(InstanceTemplate template, StatSet parameters, boolean onlyLeader, boolean showMessageAndHtml)
  38. +   {
  39. +       super(template, parameters, true, showMessageAndHtml);
  40. +       setSystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
  41. +   }
  42. +  
  43. +   @Override
  44. +   public boolean test(PlayerInstance player, Npc npc)
  45. +   {
  46. +       final AbstractPlayerGroup group = player.getCommandChannel();
  47. +       return ((group != null) && group.isLeader(player) && group.forEachMember(m ->
  48. +       {
  49. +           if (m.getClan() == player.getClan())
  50. +           {
  51. +               return true;
  52. +           }
  53. +           return false;
  54. +       }));
  55. +   }
  56. +}
  57. \ No newline at end of file
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement