Add blockednotification format in config
This commit is contained in:
+1
-1
@@ -97,7 +97,7 @@
|
||||
<dependency><!-- Galaxy -->
|
||||
<groupId>com.alttd</groupId>
|
||||
<artifactId>galaxy-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
||||
@@ -1,21 +1,31 @@
|
||||
package com.alttd.chat.util;
|
||||
|
||||
import com.alttd.chat.config.Config;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GalaxyUtility {
|
||||
public static void sendBlockedNotification(String prefix, Player player, String input, String target) {
|
||||
MiniMessage miniMessage = MiniMessage.get();
|
||||
|
||||
List<Template> templates = new ArrayList<>(List.of(
|
||||
Template.of("prefix", prefix),
|
||||
Template.of("displayname", Utility.getDisplayName(player.getUniqueId(), player.getName())),
|
||||
Template.of("target", (target.isEmpty() ? " tried to say: " : " -> " + target + ": ")),
|
||||
Template.of("input", input)
|
||||
));
|
||||
Component blockedNotification = miniMessage.parse(Config.NOTIFICATIONFORMAT, templates);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(a ->{
|
||||
Component blockedNotification = miniMessage.parse("<red>[" + prefix + "] "
|
||||
+ Utility.getDisplayName(player.getUniqueId(), player.getName())
|
||||
+ (target.isEmpty() ? " tried to say: " : " -> " + target + ": ")
|
||||
+ input + "</red>");
|
||||
if (a.hasPermission("chat.alert-blocked")) {
|
||||
a.sendMessage(blockedNotification);//TODO make configurable (along with all the messages)
|
||||
a.sendMessage(blockedNotification);
|
||||
}
|
||||
});
|
||||
player.sendMessage(miniMessage.parse("<red>The language you used in your message is not allowed, " +
|
||||
|
||||
Reference in New Issue
Block a user