Don't let someone join a party they are already in

This commit is contained in:
2022-03-02 17:30:19 +01:00
parent 23e7c57333
commit 7c9b12c394
2 changed files with 6 additions and 0 deletions
@@ -10,6 +10,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
@@ -45,6 +46,10 @@ public class Join implements SubCommand {
// party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); //Removed until we can get nicknames to translate to colors correctly
ChatUser chatUser = ChatUserManager.getChatUser(player.getUniqueId());
if (chatUser.getPartyId() == party.getPartyId()) {
source.sendMessage(Utility.parseMiniMessage(Config.ALREADY_IN_THIS_PARTY, Placeholder.miniMessage("party", party.getPartyName())));
return;
}
party.addUser(chatUser, player.getUsername());
source.sendMessage(Utility.parseMiniMessage(Config.JOINED_PARTY, Placeholder.miniMessage("party_name", party.getPartyName())));
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party,