Merge remote-tracking branch 'origin/main'

This commit is contained in:
Teriuihi 2023-08-11 22:30:34 +02:00
commit f1deebf49e
4 changed files with 7 additions and 4 deletions

View File

@ -172,6 +172,7 @@ public final class Config {
public static String CONSOLENAME = "Console";
public static UUID CONSOLEUUID = UUID.randomUUID();
public static int EMOTELIMIT = 3;
public static String MENTIONPLAYERTAG = "<aqua>@</aqua>";
private static void settings() {
PREFIXGROUPS = getList("settings.prefix-groups",
Lists.newArrayList("discord", "socialmedia", "eventteam", "eventleader", "youtube", "twitch", "developer"));
@ -183,6 +184,7 @@ public final class Config {
CONSOLEUUID = UUID.fromString(getString("settings.console-uuid", CONSOLEUUID.toString()));
MINIMIUMSTAFFRANK = getString("settings.minimum-staff-rank", MINIMIUMSTAFFRANK);
EMOTELIMIT = getInt("settings.emote-limit", EMOTELIMIT);
MENTIONPLAYERTAG = getString("settings.mention-player-tag", MENTIONPLAYERTAG);
}
public static List<String> MESSAGECOMMANDALIASES = new ArrayList<>();

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;
@ -59,7 +60,7 @@ public class ChatListener implements Listener {
event.result(formatComponent.replaceText(TextReplacementConfig.builder().match("%message%").replacement(message).build()));
}
private final Component mention = MiniMessage.miniMessage().deserialize("<aqua>@</aqua>"); //TODO move to config
private final Component mention = MiniMessage.miniMessage().deserialize(Config.MENTIONPLAYERTAG);
@EventHandler(ignoreCancelled = true)
public void onPlayerChat(AsyncChatEvent event) {
event.setCancelled(true); //Always cancel the event because we do not want to deal with Microsoft's stupid bans
@ -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