Wire up admin notification toggle

This commit is contained in:
nossr50 2019-05-18 14:46:48 -07:00
parent 9fb9228869
commit 65a234c6b3
3 changed files with 25 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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())