From d321851f0df7e80e5a45b018171b93ba04da5729 Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Fri, 24 Mar 2023 00:14:16 +0800 Subject: [PATCH] fix: Donation and migration of various node path --- .../MultiverseCore/MultiverseCore.java | 14 +++++++++++--- .../configuration/DefaultMVConfig.java | 17 +++++++++-------- .../configuration/MVConfigNodes.java | 10 +++------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 631c7495..3469b17b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -11,6 +11,7 @@ import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import com.dumptruckman.minecraft.util.Logging; import com.onarandombox.MultiverseCore.anchor.AnchorManager; @@ -66,10 +67,12 @@ import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator; import com.onarandombox.MultiverseCore.world.SimpleMVWorldManager; import com.onarandombox.MultiverseCore.world.WorldProperties; import me.main__.util.SerializationConfig.SerializationConfig; +import org.bukkit.ChatColor; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPluginLoader; +import org.jetbrains.annotations.NotNull; /** * The implementation of the Multiverse-{@link MVCore}. @@ -249,10 +252,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore { */ private void logEnableMessage() { Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors()); - if (getMVConfig().isShowingDonateMessage()) { - getLogger().config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman"); - getLogger().config("One time donations are also appreciated: https://www.paypal.me/dumptruckman"); + Logging.config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman"); + Logging.config("One time donations are also appreciated: https://www.paypal.me/dumptruckman"); } } @@ -333,6 +335,12 @@ public class MultiverseCore extends JavaPlugin implements MVCore { return this.pluginCount; } + @NotNull + @Override + public Logger getLogger() { + return Logging.getLogger(); + } + /** * {@inheritDoc} */ diff --git a/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java b/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java index a8988b27..5dba9bea 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java +++ b/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java @@ -51,12 +51,13 @@ public class DefaultMVConfig implements MVConfig { //.addAction(MoveMigratorAction.of("multiverse-configuration.displaypermerrors", "")) .addAction(MoveMigratorAction.of("multiverse-configuration.globaldebug", "misc.global-debug")) .addAction(MoveMigratorAction.of("multiverse-configuration.silentstart", "misc.silent-start")) - .addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnworld", "worlds.first-spawn-location")) - .addAction(MoveMigratorAction.of("multiverse-configuration.defaultportalsearch", "portals.use-custom-portal-search")) - .addAction(InvertBoolMigratorAction.of("portals.use-custom-portal-search")) - .addAction(MoveMigratorAction.of("multiverse-configuration.portalsearchradius", "portals.custom-portal-search-radius")) + .addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnworld", "spawn.first-spawn-location")) + .addAction(MoveMigratorAction.of("multiverse-configuration.defaultportalsearch", "portal.use-custom-portal-search")) + .addAction(InvertBoolMigratorAction.of("portal.use-custom-portal-search")) + .addAction(MoveMigratorAction.of("multiverse-configuration.portalsearchradius", "portal.custom-portal-search-radius")) .addAction(MoveMigratorAction.of("multiverse-configuration.autopurge", "world.auto-purge-entities")) - .addAction(MoveMigratorAction.of("multiverse-configuration.idonotwanttodonate", "misc.i-dont-want-to-donate")) + .addAction(MoveMigratorAction.of("multiverse-configuration.idonotwanttodonate", "misc.show-donation-message")) + .addAction(InvertBoolMigratorAction.of("misc.show-donation-message")) .build()) .build()) .build(); @@ -211,12 +212,12 @@ public class DefaultMVConfig implements MVConfig { } @Override - public void setShowDonateMessage(boolean idonotwanttodonate) { - settings.set(MVConfigNodes.I_DONT_WANT_TO_DONATE, idonotwanttodonate); + public void setShowDonateMessage(boolean showDonateMessage) { + settings.set(MVConfigNodes.SHOW_DONATION_MESSAGE, showDonateMessage); } @Override public boolean isShowingDonateMessage() { - return settings.get(MVConfigNodes.I_DONT_WANT_TO_DONATE); + return settings.get(MVConfigNodes.SHOW_DONATION_MESSAGE); } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/configuration/MVConfigNodes.java b/src/main/java/com/onarandombox/MultiverseCore/configuration/MVConfigNodes.java index 3ce3ebfc..c1c6d762 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/configuration/MVConfigNodes.java +++ b/src/main/java/com/onarandombox/MultiverseCore/configuration/MVConfigNodes.java @@ -1,9 +1,5 @@ package com.onarandombox.MultiverseCore.configuration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - import com.onarandombox.MultiverseCore.utils.settings.node.MVCommentedNode; import com.onarandombox.MultiverseCore.utils.settings.node.MVValueNode; import com.onarandombox.MultiverseCore.utils.settings.node.NodeGroup; @@ -157,10 +153,10 @@ public class MVConfigNodes { .defaultValue(false) .build()); - public static final MVValueNode I_DONT_WANT_TO_DONATE = node(MVValueNode.builder("misc.i-dont-want-to-donate", Boolean.class) + public static final MVValueNode SHOW_DONATION_MESSAGE = node(MVValueNode.builder("misc.show-donation-message", Boolean.class) .comment("") - .comment("If you don't want to donate, you can set this to true and Multiverse will stop nagging you.") - .defaultValue(false) + .comment("If you don't want to donate, you can set this to false and Multiverse will stop nagging you.") + .defaultValue(true) .build()); public static final MVValueNode VERSION = node(MVValueNode.builder("version", Double.class)