mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +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;
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getParty() == party) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", party.getName()));
|
||||
addToParty(player, mcMMOPlayer, party);
|
||||
}
|
||||
@ -339,6 +343,10 @@ public final class PartyManager {
|
||||
public static void joinInvitedParty(Player player, McMMOPlayer mcMMOPlayer) {
|
||||
Party invite = mcMMOPlayer.getPartyInvite();
|
||||
|
||||
if (mcMMOPlayer.getParty() == invite) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!parties.contains(invite)) {
|
||||
parties.add(invite);
|
||||
}
|
||||
@ -356,6 +364,10 @@ public final class PartyManager {
|
||||
* @param party The party
|
||||
*/
|
||||
public static void addToParty(OfflinePlayer player, McMMOPlayer mcMMOPlayer, Party party) {
|
||||
if (mcMMOPlayer.getParty() == party) {
|
||||
return;
|
||||
}
|
||||
|
||||
informPartyMembersJoin(player, party);
|
||||
mcMMOPlayer.setParty(party);
|
||||
party.getMembers().add(player);
|
||||
|
Loading…
Reference in New Issue
Block a user