Fixed party notifs and spy

This commit is contained in:
2022-02-15 02:32:38 +01:00
parent 2b77607072
commit e6e1073958
4 changed files with 21 additions and 3 deletions
@@ -3,8 +3,10 @@ package com.alttd.velocitychat.commands.partysubcommands;
import com.alttd.chat.config.Config;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.managers.PartyManager;
import com.alttd.chat.objects.ChatUser;
import com.alttd.chat.objects.Party;
import com.alttd.chat.util.Utility;
import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
@@ -42,8 +44,14 @@ public class Join implements SubCommand {
}
// party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); //Removed until we can get nicknames to translate to colors correctly
party.addUser(ChatUserManager.getChatUser(player.getUniqueId()), player.getUsername());
ChatUser chatUser = ChatUserManager.getChatUser(player.getUniqueId());
party.addUser(chatUser, player.getUsername());
source.sendMessage(Utility.parseMiniMessage(Config.JOINED_PARTY, Placeholder.miniMessage("party_name", party.getPartyName())));
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party,
Utility.parseMiniMessage(Config.PLAYER_JOINED_PARTY,
Placeholder.component("player_name", chatUser.getDisplayName()),
Placeholder.miniMessage("party_name", party.getPartyName())
), null);
}
@Override
@@ -1,6 +1,7 @@
package com.alttd.velocitychat.commands.partysubcommands;
import com.alttd.chat.config.Config;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.managers.PartyManager;
import com.alttd.chat.objects.Party;
import com.alttd.chat.util.Utility;
@@ -48,8 +49,14 @@ public class Name implements SubCommand {
));
return;
}
String oldName = party.getPartyName();
party.setPartyName(args[1]);
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party, Utility.parseMiniMessage(Config.RENAMED_PARTY), null);
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party, Utility.parseMiniMessage(Config.RENAMED_PARTY,
Placeholder.component("owner", ChatUserManager.getChatUser(player.getUniqueId()).getDisplayName()),
Placeholder.miniMessage("old_name", oldName),
Placeholder.miniMessage("new_name", args[1])
), null);
}
@Override
@@ -131,6 +131,7 @@ public class ChatHandler {
Map<String, Replacement<?>> placeholders = new HashMap<>();
placeholders.put("sender", Replacement.component(senderName));
placeholders.put("username", Replacement.miniMessage(player.getUsername()));
placeholders.put("party", Replacement.miniMessage(party.getPartyName()));
placeholders.put("message", Replacement.miniMessage(updatedMessage));
placeholders.put("server", Replacement.miniMessage(serverConnection.getServer().getServerInfo().getName()));