From a325f23838eb6b6aacfcbf4ef2e9cc13a94cb173 Mon Sep 17 00:00:00 2001 From: RayzsYT <51991564+RayzsYT@users.noreply.github.com> Date: Sun, 19 May 2024 19:55:50 +0200 Subject: [PATCH] Add Section --- .../de/rayzs/pat/api/storage/Storage.java | 1 + .../config/messages/NotificationSection.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/de/rayzs/pat/api/storage/config/messages/NotificationSection.java diff --git a/src/main/java/de/rayzs/pat/api/storage/Storage.java b/src/main/java/de/rayzs/pat/api/storage/Storage.java index e8d82d18..9701bcbd 100644 --- a/src/main/java/de/rayzs/pat/api/storage/Storage.java +++ b/src/main/java/de/rayzs/pat/api/storage/Storage.java @@ -33,6 +33,7 @@ public class Storage { public static GroupSection GROUP = new GroupSection(); public static HelpSection HELP = new HelpSection(); public static NoPermissionSection NO_PERMISSION = new NoPermissionSection(); + public static NotificationSection NOTIFICATION = new NotificationSection(); public static OnlyForProxySection NO_PROXY = new OnlyForProxySection(); public static ReloadSection RELOAD = new ReloadSection(); public static StatsSection STATS_SECTION = new StatsSection(); diff --git a/src/main/java/de/rayzs/pat/api/storage/config/messages/NotificationSection.java b/src/main/java/de/rayzs/pat/api/storage/config/messages/NotificationSection.java new file mode 100644 index 00000000..2071328e --- /dev/null +++ b/src/main/java/de/rayzs/pat/api/storage/config/messages/NotificationSection.java @@ -0,0 +1,27 @@ +package de.rayzs.pat.api.storage.config.messages; + +import de.rayzs.pat.api.storage.templates.ConfigStorage; +import de.rayzs.pat.utils.Reflection; +import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper; +import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper; + +import java.util.Arrays; +import java.util.Collections; + +public class NotificationSection extends ConfigStorage { + + public String ENABLED, DISABLED; + public MultipleMessagesHelper ALERT; + + public NotificationSection() { + super("notification"); + } + + @Override + public void load() { + super.load(); + ENABLED = new ConfigSectionHelper(this, "enabled", "&aEnabled notifications").getOrSet(); + DISABLED = new ConfigSectionHelper(this, "disabled", "&cDisabled notifications").getOrSet(); + ALERT = new MultipleMessagesHelper(this, "alert", Collections.singletonList("&8[&4ALERT&8] &c%player% &8(&7" + (Reflection.isProxyServer() ? "server: &e%server%" : "world: &e%world%") + "&8) &ctried to execute the following blocked command: &4%command%")); + } +}