Updated to 1.21 by switching to cosmos
This commit is contained in:
@@ -2,12 +2,9 @@ package com.alttd.chat.util;
|
||||
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.managers.RegexManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -16,40 +13,22 @@ import java.util.List;
|
||||
|
||||
public class GalaxyUtility {
|
||||
|
||||
public static void sendBlockedNotification(String prefix, Player player, String input, String target) {
|
||||
TagResolver placeholders = TagResolver.resolver(
|
||||
Placeholder.parsed("prefix", prefix),
|
||||
Placeholder.parsed("displayname", Utility.getDisplayName(player.getUniqueId(), player.getName())),
|
||||
Placeholder.parsed("target", (target.isEmpty() ? "tried to say:" : "-> " + target + ":")),
|
||||
Placeholder.parsed("input", input)
|
||||
);
|
||||
Component blockedNotification = Utility.parseMiniMessage(Config.NOTIFICATIONFORMAT, placeholders);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(a ->{
|
||||
if (a.hasPermission("chat.alert-blocked")) {
|
||||
a.sendMessage(blockedNotification);
|
||||
}
|
||||
});
|
||||
player.sendMessage(Utility.parseMiniMessage("<red>The language you used in your message is not allowed, " +
|
||||
"this constitutes as your only warning. Any further attempts at bypassing the filter will result in staff intervention.</red>"));
|
||||
}
|
||||
|
||||
public static void sendBlockedNotification(String prefix, Player player, Component input, String target) {
|
||||
public static void sendBlockedNotification(String prefix, Player player, ComponentLike input, String target) {
|
||||
TagResolver placeholders = TagResolver.resolver(
|
||||
Placeholder.parsed("prefix", prefix),
|
||||
Placeholder.parsed("displayname", Utility.getDisplayName(player.getUniqueId(), player.getName())),
|
||||
Placeholder.parsed("target", (target.isEmpty() ? "tried to say:" : "-> " + target + ":")),
|
||||
Placeholder.component("input", input)
|
||||
);
|
||||
Component blockedNotification = Utility.parseMiniMessage(Config.NOTIFICATIONFORMAT, placeholders);
|
||||
);
|
||||
ComponentLike blockedNotification = Utility.parseMiniMessage(Config.NOTIFICATIONFORMAT, placeholders);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(a ->{
|
||||
Bukkit.getOnlinePlayers().forEach(a -> {
|
||||
if (a.hasPermission("chat.alert-blocked")) {
|
||||
a.sendMessage(blockedNotification);
|
||||
}
|
||||
});
|
||||
player.sendMessage(Utility.parseMiniMessage("<red>The language you used in your message is not allowed, " +
|
||||
"this constitutes as your only warning. Any further attempts at bypassing the filter will result in staff intervention.</red>"));
|
||||
player.sendRichMessage("<red>The language you used in your message is not allowed, " +
|
||||
"this constitutes as your only warning. Any further attempts at bypassing the filter will result in staff intervention.</red>");
|
||||
}
|
||||
|
||||
public static void addAdditionalChatCompletions(Player player) {
|
||||
|
||||
Reference in New Issue
Block a user