Fixed party notifs and spy

This commit is contained in:
Teriuihi 2022-02-15 02:32:38 +01:00
parent 2b77607072
commit e6e1073958
4 changed files with 21 additions and 3 deletions

View File

@ -247,7 +247,7 @@ public final class Config {
}
public static String PARTY_FORMAT = "<dark_aqua>(<gray><sender></gray><hover:show_text:\"on <server>\"> → <party></hover>) <message>";
public static String PARTY_SPY = "<i><gray>PC:</gray><dark_gray> <dark_gray><sender></dark_gray>: <dark_gray><party></dark_gray> <message></dark_gray></i>";
public static String PARTY_SPY = "<i><gray>PC:</gray><dark_gray> <dark_gray><username></dark_gray>: <dark_gray><party></dark_gray> <message></dark_gray></i>";
public static String NO_PERMISSION = "<red>You don't have permission to use this command.</red>";
public static String NO_CONSOLE = "<red>This command can not be used by console</red>";
public static String CREATED_PARTY = "<green>You created a chat party called: " +
@ -260,6 +260,7 @@ public final class Config {
public static String NOT_ONLINE = "<red><player> must be online to receive an invite.</red>";
public static String INVALID_PASSWORD = "<red>Invalid password.</red>";
public static String JOINED_PARTY = "<green>You joined <party_name>!</green>";
public static String PLAYER_JOINED_PARTY = "<green><player_name> joined <party_name>!</green>";
public static String NOTIFY_FINDING_NEW_OWNER = "<dark_aqua>Since you own this chat party a new party owner will be chosen.<dark_aqua>";
public static String LEFT_PARTY = "<green>You have left the chat party!</green>";
public static String OWNER_LEFT_PARTY = "<dark_aqua>[ChatParty]: <old_owner> left the chat party, the new party owner is <new_owner>";
@ -298,6 +299,7 @@ public final class Config {
NOT_ONLINE = getString("party.messages.not-online", NOT_ONLINE);
INVALID_PASSWORD = getString("party.messages.invalid-password", INVALID_PASSWORD);
JOINED_PARTY = getString("party.messages.joined-party", JOINED_PARTY);
PLAYER_JOINED_PARTY = getString("party.messages.player-joined-party", PLAYER_JOINED_PARTY);
NOTIFY_FINDING_NEW_OWNER = getString("party.messages.notify-finding-new-owner", NOTIFY_FINDING_NEW_OWNER);
LEFT_PARTY = getString("party.messages.left-party", LEFT_PARTY);
OWNER_LEFT_PARTY = getString("party.messages.owner-left-party", OWNER_LEFT_PARTY);

View File

@ -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

View File

@ -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

View File

@ -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()));