From 9ae2cddfda5255ecc8251917b9ee27cccf124501 Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Wed, 22 Mar 2023 22:53:16 +0800 Subject: [PATCH] refactor: Flip boolean for custom portal search config --- .../com/onarandombox/MultiverseCore/api/MVConfig.java | 4 ++-- .../MultiverseCore/configuration/DefaultMVConfig.java | 8 ++++---- .../MultiverseCore/listeners/MVEntityListener.java | 2 +- .../MultiverseCore/listeners/MVPlayerListener.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MVConfig.java b/src/main/java/com/onarandombox/MultiverseCore/api/MVConfig.java index 8b158fc3..46029486 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/api/MVConfig.java +++ b/src/main/java/com/onarandombox/MultiverseCore/api/MVConfig.java @@ -68,14 +68,14 @@ public interface MVConfig { * * @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own. */ - void setUseDefaultPortalSearch(boolean useDefaultPortalSearch); + void setUseCustomPortalSearch(boolean useDefaultPortalSearch); /** * Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help. * * @return True means Bukkit will use its own default values. */ - boolean isUsingDefaultPortalSearch(); + boolean isUsingCustomPortalSearch(); /** * Sets the radius at which vanilla style portals will be searched for to connect to worlds together. diff --git a/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java b/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java index 17c72f20..16e6c2b4 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java +++ b/src/main/java/com/onarandombox/MultiverseCore/configuration/DefaultMVConfig.java @@ -126,13 +126,13 @@ public class DefaultMVConfig implements MVConfig { } @Override - public void setUseDefaultPortalSearch(boolean useDefaultPortalSearch) { - settings.set(MVConfigNodes.USE_CUSTOM_PORTAL_SEARCH, !useDefaultPortalSearch); + public void setUseCustomPortalSearch(boolean useDefaultPortalSearch) { + settings.set(MVConfigNodes.USE_CUSTOM_PORTAL_SEARCH, useDefaultPortalSearch); } @Override - public boolean isUsingDefaultPortalSearch() { - return !settings.get(MVConfigNodes.USE_CUSTOM_PORTAL_SEARCH); + public boolean isUsingCustomPortalSearch() { + return settings.get(MVConfigNodes.USE_CUSTOM_PORTAL_SEARCH); } @Override diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java index 0828bf40..d9894c56 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java @@ -115,7 +115,7 @@ public class MVEntityListener implements Listener { if (event.isCancelled() || event.getTo() == null) { return; } - if (!this.plugin.getMVConfig().isUsingDefaultPortalSearch()) { + if (this.plugin.getMVConfig().isUsingCustomPortalSearch()) { event.setSearchRadius(this.plugin.getMVConfig().getPortalSearchRadius()); } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java index 3bd1f2ae..960eb517 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java @@ -292,7 +292,7 @@ public class MVPlayerListener implements Listener { + "' was allowed to go to '" + event.getTo().getWorld().getName() + "' because enforceaccess is off."); } - if (!this.plugin.getMVConfig().isUsingDefaultPortalSearch()) { + if (this.plugin.getMVConfig().isUsingCustomPortalSearch()) { event.setSearchRadius(this.plugin.getMVConfig().getPortalSearchRadius()); } }