Skip to content

Commit

Permalink
Set minimum portal search radius to 8. Added config option.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Apr 24, 2021
1 parent 2a1d9fc commit 33b49a2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
35 changes: 27 additions & 8 deletions src/main/java/world/bentobox/bentobox/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ public class Settings implements ConfigObject {
@ConfigEntry(path = "island.clear-radius", since = "1.6.0")
private int clearRadius = 5;

@ConfigComment("Minimum nether portal search radius. This should not be less that 8 otherwise duplicate")
@ConfigComment("portals can occur")
@ConfigEntry(path = "island.portal-search-radius", since = "1.17.0")
private int minPortalSearchRadius = 8;

@ConfigComment("Number of blocks to paste per tick when pasting blueprints.")
@ConfigComment("Smaller values will help reduce noticeable lag but will make pasting take slightly longer.")
@ConfigComment("On the contrary, greater values will make pasting take less time, but this benefit is quickly severely impacted by the")
Expand Down Expand Up @@ -778,27 +783,27 @@ public void setPanelFillerMaterial(Material panelFillerMaterial) {
}


/**
/**
* Method Settings#getPlayerHeadCacheTime returns the playerHeadCacheTime of this object.
*
* @return the playerHeadCacheTime (type long) of this object.
* @since 1.14.1
*/
public long getPlayerHeadCacheTime()
{
return playerHeadCacheTime;
}
{
return playerHeadCacheTime;
}


/**
/**
* Method Settings#setPlayerHeadCacheTime sets new value for the playerHeadCacheTime of this object.
* @param playerHeadCacheTime new value for this object.
* @since 1.14.1
*/
public void setPlayerHeadCacheTime(long playerHeadCacheTime)
{
this.playerHeadCacheTime = playerHeadCacheTime;
}
{
this.playerHeadCacheTime = playerHeadCacheTime;
}


/**
Expand Down Expand Up @@ -871,4 +876,18 @@ public void setTicksBetweenCalls(long ticksBetweenCalls)
{
this.ticksBetweenCalls = ticksBetweenCalls;
}

/**
* @return the minPortalSearchRadius
*/
public int getMinPortalSearchRadius() {
return minPortalSearchRadius;
}

/**
* @param minPortalSearchRadius the minPortalSearchRadius to set
*/
public void setMinPortalSearchRadius(int minPortalSearchRadius) {
this.minPortalSearchRadius = minPortalSearchRadius;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ void setSeachRadius(PlayerEntityPortalEvent e, Island i) {
// Find max x or max z
int x = Math.abs(i.getProtectionCenter().getBlockX() - e.getFrom().getBlockX());
int z = Math.abs(i.getProtectionCenter().getBlockZ() - e.getFrom().getBlockZ());
int diff = i.getProtectionRange() - Math.max(x, z);
int diff = Math.max(plugin.getSettings().getMinPortalSearchRadius(), i.getProtectionRange() - Math.max(x, z));
BentoBox.getInstance().logDebug("Search radius = " + diff);
if (diff > 0 && diff < 128) {
e.setSearchRadius(diff);
}
Expand Down
22 changes: 17 additions & 5 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# BentoBox v1.14.1-SNAPSHOT-LOCAL configuration file.
#
# BentoBox {$version} configuration file.
#
# This configuration file contains settings that mainly apply to or manage the following elements:
# * Data storage
# * Gamemodes (commands, ...)
# * Internet connectivity (web-based content-enriched features, ...)
#
#
# Note that this configuration file is dynamic:
# * It gets updated with the newest settings and comments after BentoBox loaded its settings from it.
# * Upon updating BentoBox, new settings will be automatically added into this configuration file.
Expand All @@ -13,7 +13,7 @@
# * They are provided with default values that should not cause issues on live production servers.
# * You can however edit this file while the server is online.
# You will therefore need to run the following command in order to take the changes into account: /bentobox reload.
#
#
# Here are a few pieces of advice before you get started:
# * You should check out our Wiki, which may provide you useful tips or insights about BentoBox's features.
# Link: https://github.com/BentoBoxWorld/BentoBox/wiki
Expand Down Expand Up @@ -58,6 +58,14 @@ general:
# This helps prevent issues if the server crashes.
# Data is also saved at important points in the game.
backup-period: 5
# How many players will be saved in one tick. Default is 200
# Reduce if you experience lag while saving.
# Do not set this too low or data might get lost!
max-saved-players-per-tick: 20
# How many islands will be saved in one tick. Default is 200
# Reduce if you experience lag while saving.
# Do not set this too low or data might get lost!
max-saved-islands-per-tick: 20
# Enable SSL connection to MongoDB, MariaDB, MySQL and PostgreSQL databases.
# Added since 1.12.0.
use-ssl: false
Expand All @@ -75,7 +83,7 @@ general:
# Add other fake player names here if required
# /!\ This feature is experimental and might not work as expected or might not work at all.
fakeplayers:
- '[CoFH]'
- '[CoFH]'
panel:
# Toggle whether panels should be closed or not when the player clicks anywhere outside of the inventory view.
close-on-click-outside: true
Expand Down Expand Up @@ -161,6 +169,10 @@ island:
# Be careful not to make this too big. Does not cover standard nether or end teleports.
# Added since 1.6.0.
clear-radius: 5
# Minimum nether portal search radius. This should not be less that 8 otherwise duplicate
# can occur.
# Added since 1.17.0.
portal-search-radius: 8
# Number of blocks to paste per tick when pasting blueprints.
# Smaller values will help reduce noticeable lag but will make pasting take slightly longer.
# On the contrary, greater values will make pasting take less time, but this benefit is quickly severely impacted by the
Expand Down

0 comments on commit 33b49a2

Please sign in to comment.