unify usafe of util methods
This commit is contained in:
parent
2f8a8fc8ff
commit
0199a67e77
|
|
@ -164,7 +164,6 @@ public final class Config {
|
|||
public static String MINIMIUMSTAFFRANK = "trainee";
|
||||
public static String CONSOLENAME = "Console";
|
||||
public static UUID CONSOLEUUID = UUID.randomUUID();
|
||||
public static String NOTIFICATIONFORMAT = "<red>[<prefix>] <displayname> <target> <input>";
|
||||
private static void settings() {
|
||||
PREFIXGROUPS = getList("settings.prefix-groups",
|
||||
Lists.newArrayList("discord", "socialmedia", "eventteam", "eventleader", "youtube", "twitch", "developer"));
|
||||
|
|
@ -175,7 +174,6 @@ public final class Config {
|
|||
CONSOLENAME = getString("settings.console-name", CONSOLENAME);
|
||||
CONSOLEUUID = UUID.fromString(getString("settings.console-uuid", CONSOLEUUID.toString()));
|
||||
MINIMIUMSTAFFRANK = getString("settings.minimum-staff-rank", MINIMIUMSTAFFRANK);
|
||||
NOTIFICATIONFORMAT = getString("settings.blockedmessage-notification", NOTIFICATIONFORMAT);
|
||||
}
|
||||
|
||||
public static List<String> MESSAGECOMMANDALIASES = new ArrayList<>();
|
||||
|
|
@ -290,4 +288,9 @@ public final class Config {
|
|||
PASSWORD = getString("database.password", PASSWORD);
|
||||
}
|
||||
|
||||
public static String NOTIFICATIONFORMAT = "<red>[<prefix>] <displayname> <target> <input>";
|
||||
private static void notificationSettings() {
|
||||
NOTIFICATIONFORMAT = getString("settings.blockedmessage-notification", NOTIFICATIONFORMAT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user