فهرست منبع

BETA: Improvements for party/command channel implementations.

Patch by: jurchiks
Reviewed by: Zoey76
Zoey76 12 سال پیش
والد
کامیت
bc8be622df

+ 33 - 17
L2J_Server_BETA/java/com/l2jserver/gameserver/model/AbstractPlayerGroup.java

@@ -35,12 +35,12 @@ import com.l2jserver.util.Rnd;
 public abstract class AbstractPlayerGroup
 {
 	/**
-	 * @return all members of this group
+	 * @return a list of all members of this group
 	 */
 	public abstract List<L2PcInstance> getMembers();
 	
 	/**
-	 * @return object IDs of all members of this group
+	 * @return a list of object IDs of the members of this group
 	 */
 	public List<Integer> getMembersObjectId()
 	{
@@ -58,10 +58,16 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return leader of this group
+	 * @return the leader of this group
 	 */
 	public abstract L2PcInstance getLeader();
 	
+	/**
+	 * Change the leader of this group to the specified player.
+	 * @param leader the player to set as the new leader of this group
+	 */
+	public abstract void setLeader(L2PcInstance leader);
+	
 	/**
 	 * @return the leader's object ID
 	 */
@@ -71,7 +77,17 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return count of all players in this group
+	 * Check if a given player is the leader of this group.
+	 * @param player the player to check
+	 * @return {@code true} if the specified player is the leader of this group, {@code false} otherwise
+	 */
+	public boolean isLeader(L2PcInstance player)
+	{
+		return (getLeaderObjectId() == player.getObjectId());
+	}
+	
+	/**
+	 * @return the count of all players in this group
 	 */
 	public int getMemberCount()
 	{
@@ -79,13 +95,13 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return level of this group
+	 * @return the level of this group
 	 */
 	public abstract int getLevel();
 	
 	/**
-	 * Broadcast packet to every member of this group
-	 * @param packet packet to broadcast
+	 * Broadcast a packet to every member of this group.
+	 * @param packet the packet to broadcast
 	 */
 	public void broadcastPacket(final L2GameServerPacket packet)
 	{
@@ -104,8 +120,8 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * Broadcasts a System Message to this group
-	 * @param message System Message to broadcast
+	 * Broadcast a system message to this group.
+	 * @param message the system message to broadcast
 	 */
 	public void broadcastMessage(SystemMessageId message)
 	{
@@ -113,7 +129,7 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * Broadcasts a string message to this group
+	 * Broadcast a text message to this group.
 	 * @param text to broadcast
 	 */
 	public void broadcastString(String text)
@@ -138,8 +154,9 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * @param player to be contained
-	 * @return {@code true} if this group contains player
+	 * Check if this group contains a given player.
+	 * @param player the player to check
+	 * @return {@code true} if this group contains the specified player, {@code false} otherwise
 	 */
 	public boolean containsPlayer(L2PcInstance player)
 	{
@@ -147,7 +164,7 @@ public abstract class AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return random member of this group
+	 * @return a random member of this group
 	 */
 	public L2PcInstance getRandomPlayer()
 	{
@@ -156,10 +173,9 @@ public abstract class AbstractPlayerGroup
 	
 	/**
 	 * Iterates over the group and executes procedure on each member
-	 * @param procedure to be executed on members, <br>
-	 *            if it returns {@code true}, loop will continue, <br>
-	 *            if it returns {@code false}, loop will break
-	 * @return {@code false} if it was interrupted by a {@code false} return of the procedure
+	 * @param procedure the prodecure to be executed on each member.<br>
+	 *            If executing the procedure on a member returns {@code true}, the loop continues to the next member, otherwise it breaks the loop
+	 * @return {@code true} if the procedure executed correctly, {@code false} if the loop was broken prematurely
 	 */
 	public boolean forEachMember(IL2Procedure<L2PcInstance> procedure)
 	{

+ 57 - 68
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2CommandChannel.java

@@ -27,40 +27,40 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.interfaces.IL2Procedure;
 import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
 import com.l2jserver.gameserver.network.serverpackets.ExCloseMPCC;
 import com.l2jserver.gameserver.network.serverpackets.ExMPCCPartyInfoUpdate;
 import com.l2jserver.gameserver.network.serverpackets.ExOpenMPCC;
-import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 
 /**
+ * This class serves as a container for command channels.
  * @author chris_00
  */
 public class L2CommandChannel extends AbstractPlayerGroup
 {
-	private final List<L2Party> _partys;
+	private final List<L2Party> _parties;
 	private L2PcInstance _commandLeader = null;
 	private int _channelLvl;
 	
 	/**
-	 * Creates a New Command Channel and Add the Leaders party to the CC
-	 * @param leader
+	 * Create a new command channel and add the leader's party to it.
+	 * @param leader the leader of this command channel
 	 */
 	public L2CommandChannel(L2PcInstance leader)
 	{
 		_commandLeader = leader;
-		_partys = new FastList<L2Party>().shared();
-		_partys.add(leader.getParty());
-		_channelLvl = leader.getParty().getLevel();
-		leader.getParty().setCommandChannel(this);
-		leader.getParty().broadcastMessage(SystemMessageId.COMMAND_CHANNEL_FORMED);
-		leader.getParty().broadcastPacket(ExOpenMPCC.STATIC_PACKET);
+		L2Party party = leader.getParty();
+		_parties = new FastList<L2Party>().shared();
+		_parties.add(party);
+		_channelLvl = party.getLevel();
+		party.setCommandChannel(this);
+		party.broadcastMessage(SystemMessageId.COMMAND_CHANNEL_FORMED);
+		party.broadcastPacket(ExOpenMPCC.STATIC_PACKET);
 	}
 	
 	/**
-	 * Adds a Party to the Command Channel
-	 * @param party
+	 * Add a party to this command channel.
+	 * @param party the party to add
 	 */
 	public void addParty(L2Party party)
 	{
@@ -71,7 +71,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
 		// Update the CCinfo for existing players
 		broadcastPacket(new ExMPCCPartyInfoUpdate(party, 1));
 		
-		_partys.add(party);
+		_parties.add(party);
 		if (party.getLevel() > _channelLvl)
 		{
 			_channelLvl = party.getLevel();
@@ -82,8 +82,8 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * Removes a Party from the Command Channel
-	 * @param party
+	 * Remove a party from this command channel.
+	 * @param party the party to remove
 	 */
 	public void removeParty(L2Party party)
 	{
@@ -92,9 +92,9 @@ public class L2CommandChannel extends AbstractPlayerGroup
 			return;
 		}
 		
-		_partys.remove(party);
+		_parties.remove(party);
 		_channelLvl = 0;
-		for (L2Party pty : _partys)
+		for (L2Party pty : _parties)
 		{
 			if (pty.getLevel() > _channelLvl)
 			{
@@ -103,7 +103,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
 		}
 		party.setCommandChannel(null);
 		party.broadcastPacket(new ExCloseMPCC());
-		if (_partys.size() < 2)
+		if (_parties.size() < 2)
 		{
 			broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.COMMAND_CHANNEL_DISBANDED));
 			disbandChannel();
@@ -116,31 +116,31 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * disbands the whole Command Channel
+	 * Disband this command channel.
 	 */
 	public void disbandChannel()
 	{
-		if (_partys != null)
+		if (_parties != null)
 		{
-			for (L2Party party : _partys)
+			for (L2Party party : _parties)
 			{
 				if (party != null)
 				{
 					removeParty(party);
 				}
 			}
-			_partys.clear();
+			_parties.clear();
 		}
 	}
 	
 	/**
-	 * @return overall member count of the Command Channel
+	 * @return the total count of all members of this command channel
 	 */
 	@Override
 	public int getMemberCount()
 	{
 		int count = 0;
-		for (L2Party party : _partys)
+		for (L2Party party : _parties)
 		{
 			if (party != null)
 			{
@@ -151,33 +151,15 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * Broadcast packet to every channel member
-	 * @param gsp
-	 * @deprecated
-	 * @see L2CommandChannel#broadcastPacket(L2GameServerPacket)
-	 */
-	@Deprecated
-	public void broadcastToChannelMembers(L2GameServerPacket gsp)
-	{
-		broadcastPacket(gsp);
-	}
-	
-	@Deprecated
-	public void broadcastCSToChannelMembers(CreatureSay gsp, L2PcInstance broadcaster)
-	{
-		broadcastCreatureSay(gsp, broadcaster);
-	}
-	
-	/**
-	 * @return list of Parties in Command Channel
+	 * @return a list of all parties in this command channel
 	 */
 	public List<L2Party> getPartys()
 	{
-		return _partys;
+		return _parties;
 	}
 	
 	/**
-	 * @return list of all Members in Command Channel
+	 * @return a list of all members in this command channel
 	 */
 	@Override
 	public List<L2PcInstance> getMembers()
@@ -191,7 +173,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return Level of CC
+	 * @return the level of this command channel (equals the level of the highest-leveled character in this command channel)
 	 */
 	@Override
 	public int getLevel()
@@ -199,23 +181,14 @@ public class L2CommandChannel extends AbstractPlayerGroup
 		return _channelLvl;
 	}
 	
-	/**
-	 * @param leader the leader of the Command Channel
-	 */
-	public void setChannelLeader(L2PcInstance leader)
+	@Override
+	public void setLeader(L2PcInstance leader)
 	{
 		_commandLeader = leader;
-	}
-	
-	/**
-	 * @return the leader of the Command Channel
-	 * @deprecated
-	 * @see L2CommandChannel#getLeader()
-	 */
-	@Deprecated
-	public L2PcInstance getChannelLeader()
-	{
-		return getLeader();
+		if (leader.getLevel() > _channelLvl)
+		{
+			_channelLvl = leader.getLevel();
+		}
 	}
 	
 	/**
@@ -232,7 +205,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return the leader of the Command Channel
+	 * @return the leader of this command channel
 	 */
 	@Override
 	public L2PcInstance getLeader()
@@ -240,12 +213,17 @@ public class L2CommandChannel extends AbstractPlayerGroup
 		return _commandLeader;
 	}
 	
+	/**
+	 * Check if a given player is in this command channel.
+	 * @param player the player to check
+	 * @return {@code true} if he does, {@code false} otherwise
+	 */
 	@Override
 	public boolean containsPlayer(L2PcInstance player)
 	{
-		if ((_partys != null) && !_partys.isEmpty())
+		if ((_parties != null) && !_parties.isEmpty())
 		{
-			for (L2Party party : _partys)
+			for (L2Party party : _parties)
 			{
 				if (party.containsPlayer(player))
 				{
@@ -257,15 +235,15 @@ public class L2CommandChannel extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * Iterates over CC without need to allocate any new list
+	 * Iterates over all command channel members without the need to allocate a new list
 	 * @see com.l2jserver.gameserver.model.AbstractPlayerGroup#forEachMember(IL2Procedure)
 	 */
 	@Override
 	public boolean forEachMember(IL2Procedure<L2PcInstance> procedure)
 	{
-		if ((_partys != null) && !_partys.isEmpty())
+		if ((_parties != null) && !_parties.isEmpty())
 		{
-			for (L2Party party : _partys)
+			for (L2Party party : _parties)
 			{
 				if (!party.forEachMember(procedure))
 				{
@@ -275,4 +253,15 @@ public class L2CommandChannel extends AbstractPlayerGroup
 		}
 		return true;
 	}
+	
+	/**
+	 * Check whether the leader of this command channel is the same as the leader of the specified command channel<br>
+	 * (which essentially means they're the same group).
+	 * @param cc the other command channel to check against
+	 * @return {@code true} if this command channel equals the specified command channel, {@code false} otherwise
+	 */
+	public boolean equals(L2CommandChannel cc)
+	{
+		return (getLeaderObjectId() == cc.getLeaderObjectId());
+	}
 }

+ 51 - 94
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Party.java

@@ -46,7 +46,6 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.stats.Stats;
 import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
 import com.l2jserver.gameserver.network.serverpackets.ExAskModifyPartyLooting;
 import com.l2jserver.gameserver.network.serverpackets.ExCloseMPCC;
 import com.l2jserver.gameserver.network.serverpackets.ExOpenMPCC;
@@ -64,35 +63,24 @@ import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.Rnd;
 
 /**
- * This class ...
+ * This class serves as a container for player parties.
  * @author nuocnam
- * @version $Revision: 1.6.2.2.2.6 $ $Date: 2005/04/11 19:12:16 $
  */
 public class L2Party extends AbstractPlayerGroup
 {
 	private static final Logger _log = Logger.getLogger(L2Party.class.getName());
+	// @formatter:off
 	private static final double[] BONUS_EXP_SP =
 	{
-		1,
-		1.10,
-		1.20,
-		1.30,
-		1.40,
-		1.50,
-		2.0,
-		2.10,
-		2.20
+		1.0, 1.10, 1.20, 1.30, 1.40, 1.50, 2.0, 2.10, 2.20
 	};
 	// TODO: JIV - unhardcode to some SysString enum (sysstring-e.dat)
 	private static final int[] LOOT_SYSSTRINGS =
 	{
-		487,
-		488,
-		798,
-		799,
-		800
+		487, 488, 798, 799, 800
 	};
-	private static final int PARTY_POSITION_BROADCAST = 12000;
+	// @formatter:on
+	private static final int PARTY_POSITION_BROADCAST_DELAY = 12000;
 	
 	public static final byte ITEM_LOOTER = 0;
 	public static final byte ITEM_RANDOM = 1;
@@ -128,21 +116,21 @@ public class L2Party extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * constructor ensures party has always one member - leader
-	 * @param leader
-	 * @param itemDistribution
+	 * Construct a new L2Party object with a single member - the leader.
+	 * @param leader the leader of this party
+	 * @param itemDistribution the item distribution rule of this party
 	 */
 	public L2Party(L2PcInstance leader, int itemDistribution)
 	{
 		_members = new FastList<L2PcInstance>().shared();
-		_itemDistribution = itemDistribution;
-		getMembers().add(leader);
+		_members.add(leader);
 		_partyLvl = leader.getLevel();
+		_itemDistribution = itemDistribution;
 	}
 	
 	/**
-	 * Check if another player can start invitation process
-	 * @return boolean if party waits for invitation respond
+	 * Check if another player can start invitation process.
+	 * @return {@code true} if this party waits for a response on an invitation, {@code false} otherwise
 	 */
 	public boolean getPendingInvitation()
 	{
@@ -150,8 +138,9 @@ public class L2Party extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * set invitation process flag and store time for expiration happens when: player join party or player decline to join
-	 * @param val
+	 * Set invitation process flag and store time for expiration. <br>
+	 * Happens when a player joins party or declines to join.
+	 * @param val the pending invitation state to set
 	 */
 	public void setPendingInvitation(boolean val)
 	{
@@ -160,38 +149,27 @@ public class L2Party extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * Check if player invitation is expired
-	 * @return boolean if time is expired
+	 * Check if a player invitation request is expired.
+	 * @return {@code true} if time is expired, {@code false} otherwise
 	 * @see com.l2jserver.gameserver.model.actor.instance.L2PcInstance#isRequestExpired()
 	 */
 	public boolean isInvitationRequestExpired()
 	{
-		return !(_pendingInviteTimeout > GameTimeController.getGameTicks());
+		return (_pendingInviteTimeout <= GameTimeController.getGameTicks());
 	}
 	
 	/**
-	 * returns all party members
-	 * @return
-	 * @deprecated
-	 */
-	@Deprecated
-	public final FastList<L2PcInstance> getPartyMembers()
-	{
-		return (FastList<L2PcInstance>) getMembers();
-	}
-	
-	/**
-	 * get random member from party
-	 * @param ItemId
-	 * @param target
-	 * @return
+	 * Get a random member from this party.
+	 * @param itemId the ID of the item for which the member must have inventory space
+	 * @param target the object of which the member must be within a certain range (must not be null)
+	 * @return a random member from this party or {@code null} if none of the members have inventory space for the specified item
 	 */
-	private L2PcInstance getCheckedRandomMember(int ItemId, L2Character target)
+	private L2PcInstance getCheckedRandomMember(int itemId, L2Character target)
 	{
 		List<L2PcInstance> availableMembers = new FastList<>();
 		for (L2PcInstance member : getMembers())
 		{
-			if (member.getInventory().validateCapacityByItemId(ItemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
+			if (member.getInventory().validateCapacityByItemId(itemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
 			{
 				availableMembers.add(member);
 			}
@@ -276,35 +254,6 @@ public class L2Party extends AbstractPlayerGroup
 		return looter;
 	}
 	
-	/**
-	 * @param player the player to check.
-	 * @return {code true} if player is party leader.
-	 */
-	public boolean isLeader(L2PcInstance player)
-	{
-		return getLeader().getObjectId() == player.getObjectId();
-	}
-	
-	/**
-	 * @return the Object ID for the party leader to be used as a unique identifier of this party-
-	 * @deprecated use {@link #getLeaderObjectId()}
-	 */
-	@Deprecated
-	public int getPartyLeaderOID()
-	{
-		return getLeaderObjectId();
-	}
-	
-	/**
-	 * Broadcasts packet to all party member.
-	 * @param packet the packet to be broadcasted.
-	 */
-	@Deprecated
-	public void broadcastToPartyMembers(L2GameServerPacket packet)
-	{
-		broadcastPacket(packet);
-	}
-	
 	/**
 	 * Broadcasts UI update and User Info for new party leader.
 	 */
@@ -321,12 +270,6 @@ public class L2Party extends AbstractPlayerGroup
 		}
 	}
 	
-	@Deprecated
-	public void broadcastCSToPartyMembers(CreatureSay msg, L2PcInstance broadcaster)
-	{
-		broadcastCreatureSay(msg, broadcaster);
-	}
-	
 	/**
 	 * Send a Server->Client packet to all other L2PcInstance of the Party.<BR>
 	 * <BR>
@@ -427,7 +370,7 @@ public class L2Party extends AbstractPlayerGroup
 		
 		if (_positionBroadcastTask == null)
 		{
-			_positionBroadcastTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PositionBroadcast(), PARTY_POSITION_BROADCAST / 2, PARTY_POSITION_BROADCAST);
+			_positionBroadcastTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PositionBroadcast(), PARTY_POSITION_BROADCAST_DELAY / 2, PARTY_POSITION_BROADCAST_DELAY);
 		}
 	}
 	
@@ -574,7 +517,7 @@ public class L2Party extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * Disperse a party and sends a message to all its members.
+	 * Disperse a party and send a message to all its members.
 	 */
 	public void disbandParty()
 	{
@@ -594,12 +537,16 @@ public class L2Party extends AbstractPlayerGroup
 	
 	/**
 	 * Change party leader (used for string arguments)
-	 * @param name
+	 * @param name the name of the player to set as the new party leader
 	 */
 	public void changePartyLeader(String name)
 	{
-		L2PcInstance player = getPlayerByName(name);
-		
+		setLeader(getPlayerByName(name));
+	}
+	
+	@Override
+	public void setLeader(L2PcInstance player)
+	{
 		if ((player != null) && !player.isInDuel())
 		{
 			if (getMembers().contains(player))
@@ -611,19 +558,18 @@ public class L2Party extends AbstractPlayerGroup
 				else
 				{
 					// Swap party members
-					L2PcInstance temp;
+					L2PcInstance temp = getLeader();
 					int p1 = getMembers().indexOf(player);
-					temp = getLeader();
-					getMembers().set(0, getMembers().get(p1));
+					getMembers().set(0, player);
 					getMembers().set(p1, temp);
 					
 					SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BECOME_A_PARTY_LEADER);
 					msg.addString(getLeader().getName());
 					broadcastPacket(msg);
 					broadcastToPartyMembersNewLeader();
-					if (isInCommandChannel() && (temp.getObjectId() == _commandChannel.getLeader().getObjectId()))
+					if (isInCommandChannel() && _commandChannel.isLeader(temp))
 					{
-						_commandChannel.setChannelLeader(getLeader());
+						_commandChannel.setLeader(getLeader());
 						msg = SystemMessage.getSystemMessage(SystemMessageId.COMMAND_CHANNEL_LEADER_NOW_C1);
 						msg.addString(_commandChannel.getLeader().getName());
 						_commandChannel.broadcastPacket(msg);
@@ -640,7 +586,6 @@ public class L2Party extends AbstractPlayerGroup
 				player.sendPacket(SystemMessageId.YOU_CAN_TRANSFER_RIGHTS_ONLY_TO_ANOTHER_PARTY_MEMBER);
 			}
 		}
-		
 	}
 	
 	/**
@@ -1069,6 +1014,9 @@ public class L2Party extends AbstractPlayerGroup
 		return _dr;
 	}
 	
+	/**
+	 * @return the leader of this party
+	 */
 	@Override
 	public L2PcInstance getLeader()
 	{
@@ -1187,7 +1135,7 @@ public class L2Party extends AbstractPlayerGroup
 	}
 	
 	/**
-	 * @return reurns all party members
+	 * @return a list of all members of this party
 	 */
 	@Override
 	public List<L2PcInstance> getMembers()
@@ -1195,4 +1143,13 @@ public class L2Party extends AbstractPlayerGroup
 		return _members;
 	}
 	
+	/**
+	 * Check whether the leader of this party is the same as the leader of the specified party (which essentially means they're the same group).
+	 * @param party the other party to check against
+	 * @return {@code true} if this party equals the specified party, {@code false} otherwise
+	 */
+	public boolean equals(L2Party party)
+	{
+		return (getLeaderObjectId() == party.getLeaderObjectId());
+	}
 }

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestChangePartyLeader.java

@@ -18,15 +18,14 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
+import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 /**
- * This class ...
- * @version $Revision: 1.3.4.2 $ $Date: 2005/03/27 15:29:30 $
+ * This packet is received from client when a party leader requests to change the leadership to another player in his party.
  */
 public final class RequestChangePartyLeader extends L2GameClientPacket
 {
-	
 	private static final String _C__D0_0C_REQUESTCHANGEPARTYLEADER = "[C] D0:0C RequestChangePartyLeader";
 	
 	private String _name;
@@ -46,9 +45,10 @@ public final class RequestChangePartyLeader extends L2GameClientPacket
 			return;
 		}
 		
-		if (activeChar.isInParty() && activeChar.getParty().isLeader(activeChar))
+		L2Party party = activeChar.getParty();
+		if ((party != null) && party.isLeader(activeChar))
 		{
-			activeChar.getParty().changePartyLeader(_name);
+			party.changePartyLeader(_name);
 		}
 	}
 	

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestPartyLootModification.java

@@ -49,7 +49,7 @@ public class RequestPartyLootModification extends L2GameClientPacket
 			return;
 		}
 		L2Party party = activeChar.getParty();
-		if ((party == null) || (_mode == party.getLootDistribution()) || (party.getLeader() != activeChar))
+		if ((party == null) || !party.isLeader(activeChar) || (_mode == party.getLootDistribution()))
 		{
 			return;
 		}