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);
}

View File

@ -28,6 +28,7 @@ Skills:
SuperAbilityInteraction: true
SuperAbilityAlertOthers: true
ExperienceGain: true
PartyMessage: true
General:
Ability:
Length:

View File

@ -560,6 +560,7 @@ Commands.Party.Invite.Accepted=[[GREEN]]Invite Accepted. You have joined party {
Commands.Party.Join=[[GRAY]]Joined Party: {0}
Commands.Party.PartyFull=[[GOLD]]{0}[[RED]] is full!
Commands.Party.PartyFull.Invite=[[RED]]You cannot invite [[YELLOW]]{0}[[RED]] to [[GREEN]]{1}[[RED]] because it already has [[DARK_AQUA]]{2}[[RED]] players in it!
Commands.Party.PartyFull.InviteAccept=[[RED]]You cannot join [[GREEN]]{0}[[RED]] because it already has [[DARK_AQUA]]{1}[[RED]] players in it!
Commands.Party.Create=[[GRAY]]Created Party: {0}
Commands.Party.Rename=[[GRAY]]Party name changed to: [[WHITE]]{0}
Commands.Party.SetSharing=[[GRAY]]Party {0} sharing set to: [[DARK_AQUA]]{1}