From 06875e1aabe28181a62c3b75456df223f17efe81 Mon Sep 17 00:00:00 2001 From: Nathan Thor Date: Fri, 27 Aug 2021 17:50:08 -0700 Subject: [PATCH] Added Reload on TradeShop Reload --- pom.xml | 2 +- .../shanerx/tradeshoparm/TradeShopARM.java | 1 + .../shanerx/tradeshoparm/enumys/Setting.java | 4 ++ .../TradeShopReloadEventListener.java | 45 +++++++++++++++++++ version.txt | 2 +- 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/shanerx/tradeshoparm/listeners/TradeShopReloadEventListener.java diff --git a/pom.xml b/pom.xml index 6a4078e..03ba586 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ org.shanerx tradeshop-arm - 0.0.2-DEV + 0.0.3-DEV TradeShop-ARM https://tradeshop.github.io/ Add-On plugin for Tradeshop that adds support for Advanced Region Management diff --git a/src/main/java/org/shanerx/tradeshoparm/TradeShopARM.java b/src/main/java/org/shanerx/tradeshoparm/TradeShopARM.java index 0769050..09b8a38 100644 --- a/src/main/java/org/shanerx/tradeshoparm/TradeShopARM.java +++ b/src/main/java/org/shanerx/tradeshoparm/TradeShopARM.java @@ -45,6 +45,7 @@ public void onEnable() { PluginManager pm = getServer().getPluginManager(); pm.registerEvents(new ARMRestoreRegionEventListener(this), this); + pm.registerEvents(new TradeShopReloadEventListener(), this); if (Setting.CHECK_UPDATES.getBoolean()) { new Thread(() -> getUpdater().checkCurrentVersion()).start(); diff --git a/src/main/java/org/shanerx/tradeshoparm/enumys/Setting.java b/src/main/java/org/shanerx/tradeshoparm/enumys/Setting.java index a8d37d0..060e07f 100644 --- a/src/main/java/org/shanerx/tradeshoparm/enumys/Setting.java +++ b/src/main/java/org/shanerx/tradeshoparm/enumys/Setting.java @@ -45,6 +45,10 @@ public enum Setting { CONFIG_VERSION(SettingSectionKeys.NONE, "config-version", 1.0, "", "\n"), + // Language Options + MESSAGE_PREFIX(SettingSectionKeys.LANGUAGE_OPTIONS, "message-prefix", "&a[&eTradeShop-ARM&a] ", "The prefix the displays before all plugin messages", "\n"), + + // System Options ENABLE_DEBUG(SettingSectionKeys.SYSTEM_OPTIONS, "enable-debug", 0, "What debug code should be run. this will add significant amounts of spam to the console/log, generally not used unless requested by Devs (must be a whole number)"), CHECK_UPDATES(SettingSectionKeys.SYSTEM_OPTIONS, "check-updates", true, "Should we check for updates when the server starts"), ALLOW_METRICS(SettingSectionKeys.SYSTEM_OPTIONS, "allow-metrics", true, "Allow us to connect anonymous metrics so we can see how our plugin is being used to better develop it"); diff --git a/src/main/java/org/shanerx/tradeshoparm/listeners/TradeShopReloadEventListener.java b/src/main/java/org/shanerx/tradeshoparm/listeners/TradeShopReloadEventListener.java new file mode 100644 index 0000000..8fe2c1c --- /dev/null +++ b/src/main/java/org/shanerx/tradeshoparm/listeners/TradeShopReloadEventListener.java @@ -0,0 +1,45 @@ +/* + * + * Copyright (c) 2016-2019 + * SparklingComet @ http://shanerx.org + * KillerOfPie @ http://killerofpie.github.io + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * NOTICE: All modifications made by others to the source code belong + * to the respective contributor. No contributor should be held liable for + * any damages of any kind, whether be material or moral, which were + * caused by their contribution(s) to the project. See the full License for more information. + * + */ + +package org.shanerx.tradeshoparm.listeners; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.shanerx.tradeshop.framework.events.TradeShopReloadEvent; +import org.shanerx.tradeshop.utils.Utils; +import org.shanerx.tradeshoparm.enumys.Setting; + + +public class TradeShopReloadEventListener implements Listener { + + public TradeShopReloadEventListener() {} + + @EventHandler(priority = EventPriority.MONITOR) + public void onTradeShopReload(TradeShopReloadEvent event) { + Setting.reload(); + event.sender.sendMessage(new Utils().colorize(Setting.MESSAGE_PREFIX.getString() + "&6The configuration files have been reloaded!")); + } +} diff --git a/version.txt b/version.txt index 4a57655..a456e76 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.2-DEV \ No newline at end of file +0.0.3-DEV \ No newline at end of file