diff --git a/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdmin.java b/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdmin.java index a3561a167..af4dc0396 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdmin.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdmin.java @@ -1,8 +1,15 @@ package com.gmail.nossr50.config.hocon.admin; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigAdmin { + @Setting(value = "Admin-Notifications", comment = "Settings related to admin alerts in mcMMO.") + public ConfigAdminNotifications configAdminNotifications = new ConfigAdminNotifications(); + + public boolean isSendAdminNotifications() { + return configAdminNotifications.isSendAdminNotifications(); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdminNotifications.java b/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdminNotifications.java new file mode 100644 index 000000000..96af0610f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/admin/ConfigAdminNotifications.java @@ -0,0 +1,17 @@ +package com.gmail.nossr50.config.hocon.admin; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAdminNotifications { + private static final boolean SEND_ADMIN_NOTIFICATIONS_DEFAULT = true; + + @Setting(value = "Send-Admin-Notifications", comment = "Send admins notifications about sensitive commands being executed" + + "\nDefault value: "+ SEND_ADMIN_NOTIFICATIONS_DEFAULT) + private boolean sendAdminNotifications = SEND_ADMIN_NOTIFICATIONS_DEFAULT; + + public boolean isSendAdminNotifications() { + return sendAdminNotifications; + } +} diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 81752b285..7c01312b5 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -158,7 +158,7 @@ public class NotificationManager { */ private static void sendAdminNotification(String msg) { //If its not enabled exit - if(!Config.getInstance().adminNotifications()) + if(!mcMMO.getConfigManager().getConfigAdmin().isSendAdminNotifications()) return; for(Player player : Bukkit.getServer().getOnlinePlayers())