Check if player has a clan before joining one.

This commit is contained in:
MobiusDev 2018-09-03 22:00:38 +00:00
parent 7bb0152c38
commit a4e43d2639
19 changed files with 54 additions and 19 deletions

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -57,7 +57,7 @@ public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingP
if (pledgeRecruitInfo != null)
{
final L2Clan clan = pledgeRecruitInfo.getClan();
if (clan != null)
if ((clan != null) && (activeChar.getClan() == null))
{
clan.addClanMember(activeChar);
activeChar.sendPacket(new JoinPledge(_clanId));

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -57,7 +57,7 @@ public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingP
if (pledgeRecruitInfo != null)
{
final L2Clan clan = pledgeRecruitInfo.getClan();
if (clan != null)
if ((clan != null) && (activeChar.getClan() == null))
{
clan.addClanMember(activeChar);
activeChar.sendPacket(new JoinPledge(_clanId));

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -57,7 +57,7 @@ public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingP
if (pledgeRecruitInfo != null)
{
final L2Clan clan = pledgeRecruitInfo.getClan();
if (clan != null)
if ((clan != null) && (activeChar.getClan() == null))
{
clan.addClanMember(activeChar);
activeChar.sendPacket(new JoinPledge(_clanId));

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -57,7 +57,7 @@ public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingP
if (pledgeRecruitInfo != null)
{
final L2Clan clan = pledgeRecruitInfo.getClan();
if (clan != null)
if ((clan != null) && (activeChar.getClan() == null))
{
clan.addClanMember(activeChar);
activeChar.sendPacket(new JoinPledge(_clanId));

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);

View File

@ -81,12 +81,17 @@ public final class RequestAnswerJoinPledge implements IClientIncomingPacket
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
{
if (activeChar.getClan() != null)
{
return;
}
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
activeChar.setPledgeType(requestPacket.getPledgeType());
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
{
activeChar.setPowerGrade(9); // adademy
activeChar.setPowerGrade(9); // academy
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
}
else

View File

@ -57,7 +57,7 @@ public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingP
if (pledgeRecruitInfo != null)
{
final L2Clan clan = pledgeRecruitInfo.getClan();
if (clan != null)
if ((clan != null) && (activeChar.getClan() == null))
{
clan.addClanMember(activeChar);
activeChar.sendPacket(new JoinPledge(_clanId));

View File

@ -60,7 +60,7 @@ public class RequestPledgeWaitingUserAccept implements IClientIncomingPacket
if (_acceptRequest)
{
final L2PcInstance player = L2World.getInstance().getPlayer(_playerId);
if (player != null)
if ((player != null) && (player.getClan() == null))
{
final L2Clan clan = activeChar.getClan();
clan.addClanMember(player);