Don't allow players to accept party invites if the party is full

This commit is contained in:
nossr50
2019-01-13 00:45:17 -08:00
parent c3bacd8de6
commit e817dbe081
4 changed files with 18 additions and 3 deletions

View File

@ -15,7 +15,8 @@ public enum NotificationType {
ABILITY_COOLDOWN("AbilityCoolDown"),
ABILITY_REFRESHED("AbilityRefreshed"),
SUPER_ABILITY("SuperAbilityInteraction"),
SUPER_ABILITY_ALERT_OTHERS("SuperAbilityAlertOthers");
SUPER_ABILITY_ALERT_OTHERS("SuperAbilityAlertOthers"),
PARTY_MESSAGE("PartyMessage");
final String niceName;

View File

@ -1,8 +1,10 @@
package com.gmail.nossr50.party;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyLeader;
@ -16,6 +18,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
@ -394,11 +397,20 @@ public final class PartyManager {
// Check if the party still exists, it might have been disbanded
if (!parties.contains(invite)) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Party.Disband"));
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Party.Disband");
return;
}
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Party.Invite.Accepted", invite.getName()));
/*
* Don't let players join a full party
*/
if(Config.getInstance().getPartyMaxSize() > 0 && invite.getMembers().size() >= Config.getInstance().getPartyMaxSize())
{
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept", invite.getName(), String.valueOf(Config.getInstance().getPartyMaxSize()));
return;
}
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.Invite.Accepted", invite.getName());
mcMMOPlayer.removePartyInvite();
addToParty(mcMMOPlayer, invite);
}