unify usafe of util methods
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alttd</groupId>
|
||||
<artifactId>galaxy-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -255,17 +255,7 @@ public class ChatHandler {
|
||||
|
||||
private boolean isMuted(Player player, String message, String prefix) {
|
||||
if (Database.get().isPlayerMuted(player.getUniqueId(), null) || (ChatPlugin.getInstance().serverMuted() && !player.hasPermission("chat.bypass-server-muted"))) {
|
||||
MiniMessage miniMessage = MiniMessage.get();
|
||||
Component blockedNotification = miniMessage.parse("<red>" + prefix
|
||||
+ Utility.getDisplayName(player.getUniqueId(), player.getName())
|
||||
+ " tried to say: "
|
||||
+ message + "</red>");
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(a ->{
|
||||
if (a.hasPermission("chat.alert-blocked")) {
|
||||
a.sendMessage(blockedNotification);//TODO make configurable (along with all the messages)
|
||||
}
|
||||
});
|
||||
GalaxyUtility.sendBlockedNotification(prefix, player, message, "");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -34,13 +34,7 @@ public class ChatListener implements Listener, ChatRenderer {
|
||||
event.setCancelled(true);
|
||||
|
||||
Player player = event.getPlayer();
|
||||
MiniMessage miniMessage = MiniMessage.get();
|
||||
Component blockedNotification = miniMessage.parse("<red>[Chat Muted] "
|
||||
+ Utility.getDisplayName(player.getUniqueId(), player.getName())
|
||||
+ " tried to say: "
|
||||
+ PlainComponentSerializer.plain().serialize(event.message()) + "</red>");
|
||||
|
||||
Bukkit.broadcast(blockedNotification, "chat.alert-blocked");
|
||||
GalaxyUtility.sendBlockedNotification("Chat Muted", player, event.message(), "");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user