refactor: Flip boolean for custom portal search config

This commit is contained in:
Ben Woo 2023-03-22 22:53:16 +08:00
parent 6cc169cb55
commit 9ae2cddfda
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
4 changed files with 8 additions and 8 deletions

View File

@ -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.

View File

@ -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

View File

@ -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());
}
}

View File

@ -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());
}
}