Skip to content

Commit b4284f7

Browse files
authored
Merge pull request #2745 from BentoBoxWorld/api_auto_center_fix_option
Api auto center fix option
2 parents 2728c64 + 0e79580 commit b4284f7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<!-- Do not change unless you want different name for local builds. -->
7676
<build.number>-LOCAL</build.number>
7777
<!-- This allows to change between versions. -->
78-
<build.version>3.8.1</build.version>
78+
<build.version>3.8.2</build.version>
7979
<sonar.organization>bentobox-world</sonar.organization>
8080
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
8181
<server.jars>${project.basedir}/lib</server.jars>

src/main/java/world/bentobox/bentobox/api/addons/GameModeAddon.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,15 @@ public void saveWorldSettings() {
179179
public boolean isUsesNewChunkGeneration() {
180180
return false;
181181
}
182+
183+
/**
184+
* Indicates whether BentoBox should try to align island centers on a grid, or leave them free form.
185+
* Free form is used with some claim-based or player-selected island location addons.
186+
* @return true by default
187+
* @since 3.8.2
188+
*/
189+
public boolean isFixIslandCenter() {
190+
return true;
191+
}
182192

183193
}

src/main/java/world/bentobox/bentobox/managers/IslandsManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.google.gson.GsonBuilder;
4242

4343
import world.bentobox.bentobox.BentoBox;
44+
import world.bentobox.bentobox.api.addons.GameModeAddon;
4445
import world.bentobox.bentobox.api.events.IslandBaseEvent;
4546
import world.bentobox.bentobox.api.events.island.IslandEvent;
4647
import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
@@ -1309,7 +1310,8 @@ else if (!plugin.getSettings().isOverrideSafetyCheck()
13091310
+ island.getRange() + "!\n" + "Island ID in database is " + island.getUniqueId() + ".\n"
13101311
+ "Island distance in config.yml cannot be changed mid-game! Fix config.yml or clean database.");
13111312
} else {
1312-
if (!plugin.getSettings().isOverrideSafetyCheck()) {
1313+
// Only try to fix the island center if we have to
1314+
if (!plugin.getSettings().isOverrideSafetyCheck() && plugin.getIWM().getAddon(island.getWorld()).map(GameModeAddon::isFixIslandCenter).orElse(true)) {
13131315
// Fix island center if it is off
13141316
fixIslandCenter(island);
13151317
}

0 commit comments

Comments
 (0)