Remove non-functional Chat Placeholders

This commit is contained in:
Draycia committed 2023-07-05 21:54:03 -07:00
1 parent 78155d6d4b
commit 403c3a3059
5 files changed
+8 -36

No files matched your search

@@ -71,9 +71,6 @@ public class PrimaryConfig {
@Comment("The suggestions shown when using the TAB key in chat.")
private List<String> customChatSuggestions = List.of();
@Comment("The placeholders replaced in chat messages, this WILL work with chat previews.")
private Map<String, String> chatPlaceholders = Map.of();
@Comment("Various settings related to pinging players in channels.")
private PingSettings pingSettings = new PingSettings();
@@ -116,7 +113,7 @@ public class PrimaryConfig {
public String applyCustomPlaceholders(final String string) {
String placeholderResolvedMessage = string;
for (final var entry : this.customPlaceholders.entrySet()) {
for (final var entry : this.customPlaceholders().entrySet()) {
placeholderResolvedMessage = placeholderResolvedMessage.replace("<" + entry.getKey() + ">",
entry.getValue());
}
@@ -127,10 +124,6 @@ public class PrimaryConfig {
return this.customChatSuggestions;
}
public @Nullable Map<String, String> chatPlaceholders() {
return this.chatPlaceholders;
}
public PingSettings pings() {
return this.pingSettings;
}
@@ -21,14 +21,12 @@ package net.draycia.carbon.common.listeners;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.draycia.carbon.api.CarbonChat;
import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.event.events.CarbonChatEvent;
import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.util.KeyedRenderer;
import net.draycia.carbon.common.channels.ConfigChatChannel;
import net.draycia.carbon.common.config.ConfigFactory;
import net.draycia.carbon.common.messages.CarbonMessages;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.chat.SignedMessage;
@@ -37,28 +35,19 @@ import net.kyori.adventure.text.Component;
public abstract class ChatListenerInternal {
private final ConfigFactory configFactory;
private final CarbonMessages carbonMessages;
private final CarbonChat carbonChat;
protected ChatListenerInternal(
final CarbonChat carbonChat,
final CarbonMessages carbonMessages,
final ConfigFactory configFactory
final CarbonMessages carbonMessages
) {
this.configFactory = configFactory;
this.carbonMessages = carbonMessages;
this.carbonChat = carbonChat;
}
protected CarbonChatEvent prepareAndEmitChatEvent(final CarbonPlayer sender, final String messageContent, final SignedMessage signedMessage) {
String content = messageContent;
for (final Map.Entry<String, String> placeholder : this.configFactory.primaryConfig().chatPlaceholders().entrySet()) {
content = content.replace(placeholder.getKey(), placeholder.getValue());
}
Component message = ConfigChatChannel.parseMessageTags(sender, content);
Component message = ConfigChatChannel.parseMessageTags(sender, messageContent);
final CarbonPlayer.ChannelMessage channelMessage = sender.channelForMessage(message);
final ChatChannel channel = channelMessage.channel();