mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Add a few checks to prevent a player from joining a party more than
once.
This commit is contained in:
parent
ec8221610a
commit
219667965f
@ -294,6 +294,10 @@ public final class PartyManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mcMMOPlayer.getParty() == party) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", party.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", party.getName()));
|
||||||
addToParty(player, mcMMOPlayer, party);
|
addToParty(player, mcMMOPlayer, party);
|
||||||
}
|
}
|
||||||
@ -339,6 +343,10 @@ public final class PartyManager {
|
|||||||
public static void joinInvitedParty(Player player, McMMOPlayer mcMMOPlayer) {
|
public static void joinInvitedParty(Player player, McMMOPlayer mcMMOPlayer) {
|
||||||
Party invite = mcMMOPlayer.getPartyInvite();
|
Party invite = mcMMOPlayer.getPartyInvite();
|
||||||
|
|
||||||
|
if (mcMMOPlayer.getParty() == invite) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!parties.contains(invite)) {
|
if (!parties.contains(invite)) {
|
||||||
parties.add(invite);
|
parties.add(invite);
|
||||||
}
|
}
|
||||||
@ -356,6 +364,10 @@ public final class PartyManager {
|
|||||||
* @param party The party
|
* @param party The party
|
||||||
*/
|
*/
|
||||||
public static void addToParty(OfflinePlayer player, McMMOPlayer mcMMOPlayer, Party party) {
|
public static void addToParty(OfflinePlayer player, McMMOPlayer mcMMOPlayer, Party party) {
|
||||||
|
if (mcMMOPlayer.getParty() == party) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
informPartyMembersJoin(player, party);
|
informPartyMembersJoin(player, party);
|
||||||
mcMMOPlayer.setParty(party);
|
mcMMOPlayer.setParty(party);
|
||||||
party.getMembers().add(player);
|
party.getMembers().add(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user