Fix Tagging players and triggering a replacematcher not resetting chatcolor

This commit is contained in:
Len 2023-07-15 17:42:12 +02:00
parent 4b930e62c3
commit 9d7f944c88
3 changed files with 4 additions and 3 deletions

View File

@ -110,7 +110,7 @@ public class ChatFilter {
String group = matcher.group();
modifiableString.replace(TextReplacementConfig.builder()
.matchLiteral(group)
.replacement(group.substring(0, length))
.replacement(Component.text(group.substring(0, length), modifiableString.component().color()))
.build());
}
}

View File

@ -9,7 +9,7 @@ plugins {
dependencies {
implementation(project(":api")) // API
compileOnly("com.alttd:Galaxy-API:1.19.2-R0.1-SNAPSHOT") // Galaxy
compileOnly("com.alttd:Galaxy-API:1.20.1-R0.1-SNAPSHOT") // Galaxy
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5") // move to proxy
compileOnly("org.apache.commons:commons-lang3:3.12.0") // needs an alternative, already removed from upstream api and will be removed in server
compileOnly("net.luckperms:api:5.3") // Luckperms

View File

@ -18,6 +18,7 @@ import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.PatternReplacementResult;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
@ -81,7 +82,7 @@ public class ChatListener implements Listener {
.filter(receiver -> !ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
.collect(Collectors.toSet());
Component input = event.message();
Component input = event.message().colorIfAbsent(NamedTextColor.WHITE);
ModifiableString modifiableString = new ModifiableString(input);
// todo a better way for this