fix: Donation and migration of various node path

This commit is contained in:
Ben Woo 2023-03-24 00:14:16 +08:00
parent 7759a37b4e
commit d321851f0d
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
3 changed files with 23 additions and 18 deletions

View File

@ -11,6 +11,7 @@ import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import com.dumptruckman.minecraft.util.Logging; import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.anchor.AnchorManager; 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.SimpleMVWorldManager;
import com.onarandombox.MultiverseCore.world.WorldProperties; import com.onarandombox.MultiverseCore.world.WorldProperties;
import me.main__.util.SerializationConfig.SerializationConfig; import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.ChatColor;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader; import org.bukkit.plugin.java.JavaPluginLoader;
import org.jetbrains.annotations.NotNull;
/** /**
* The implementation of the Multiverse-{@link MVCore}. * The implementation of the Multiverse-{@link MVCore}.
@ -249,10 +252,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
*/ */
private void logEnableMessage() { private void logEnableMessage() {
Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors()); Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors());
if (getMVConfig().isShowingDonateMessage()) { if (getMVConfig().isShowingDonateMessage()) {
getLogger().config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman"); Logging.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("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; return this.pluginCount;
} }
@NotNull
@Override
public Logger getLogger() {
return Logging.getLogger();
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -51,12 +51,13 @@ public class DefaultMVConfig implements MVConfig {
//.addAction(MoveMigratorAction.of("multiverse-configuration.displaypermerrors", "")) //.addAction(MoveMigratorAction.of("multiverse-configuration.displaypermerrors", ""))
.addAction(MoveMigratorAction.of("multiverse-configuration.globaldebug", "misc.global-debug")) .addAction(MoveMigratorAction.of("multiverse-configuration.globaldebug", "misc.global-debug"))
.addAction(MoveMigratorAction.of("multiverse-configuration.silentstart", "misc.silent-start")) .addAction(MoveMigratorAction.of("multiverse-configuration.silentstart", "misc.silent-start"))
.addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnworld", "worlds.first-spawn-location")) .addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnworld", "spawn.first-spawn-location"))
.addAction(MoveMigratorAction.of("multiverse-configuration.defaultportalsearch", "portals.use-custom-portal-search")) .addAction(MoveMigratorAction.of("multiverse-configuration.defaultportalsearch", "portal.use-custom-portal-search"))
.addAction(InvertBoolMigratorAction.of("portals.use-custom-portal-search")) .addAction(InvertBoolMigratorAction.of("portal.use-custom-portal-search"))
.addAction(MoveMigratorAction.of("multiverse-configuration.portalsearchradius", "portals.custom-portal-search-radius")) .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.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()) .build())
.build(); .build();
@ -211,12 +212,12 @@ public class DefaultMVConfig implements MVConfig {
} }
@Override @Override
public void setShowDonateMessage(boolean idonotwanttodonate) { public void setShowDonateMessage(boolean showDonateMessage) {
settings.set(MVConfigNodes.I_DONT_WANT_TO_DONATE, idonotwanttodonate); settings.set(MVConfigNodes.SHOW_DONATION_MESSAGE, showDonateMessage);
} }
@Override @Override
public boolean isShowingDonateMessage() { public boolean isShowingDonateMessage() {
return settings.get(MVConfigNodes.I_DONT_WANT_TO_DONATE); return settings.get(MVConfigNodes.SHOW_DONATION_MESSAGE);
} }
} }

View File

@ -1,9 +1,5 @@
package com.onarandombox.MultiverseCore.configuration; 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.MVCommentedNode;
import com.onarandombox.MultiverseCore.utils.settings.node.MVValueNode; import com.onarandombox.MultiverseCore.utils.settings.node.MVValueNode;
import com.onarandombox.MultiverseCore.utils.settings.node.NodeGroup; import com.onarandombox.MultiverseCore.utils.settings.node.NodeGroup;
@ -157,10 +153,10 @@ public class MVConfigNodes {
.defaultValue(false) .defaultValue(false)
.build()); .build());
public static final MVValueNode<Boolean> I_DONT_WANT_TO_DONATE = node(MVValueNode.builder("misc.i-dont-want-to-donate", Boolean.class) public static final MVValueNode<Boolean> SHOW_DONATION_MESSAGE = node(MVValueNode.builder("misc.show-donation-message", Boolean.class)
.comment("") .comment("")
.comment("If you don't want to donate, you can set this to true and Multiverse will stop nagging you.") .comment("If you don't want to donate, you can set this to false and Multiverse will stop nagging you.")
.defaultValue(false) .defaultValue(true)
.build()); .build());
public static final MVValueNode<Double> VERSION = node(MVValueNode.builder("version", Double.class) public static final MVValueNode<Double> VERSION = node(MVValueNode.builder("version", Double.class)