diff --git a/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java b/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java index 33052b158..f313207be 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java @@ -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; diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index aee56ed16..baf455080 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -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); } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index d390a1c8d..ed92733f4 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -28,6 +28,7 @@ Skills: SuperAbilityInteraction: true SuperAbilityAlertOthers: true ExperienceGain: true + PartyMessage: true General: Ability: Length: diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 9db56ffa3..3b9d75dbc 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -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}