Skip to content

Commit 5c168da

Browse files
authored
Merge pull request #2725 from BentoBoxWorld/develop
Release 3.7.3
2 parents 91d18a0 + f98850f commit 5c168da

File tree

8 files changed

+42
-13
lines changed

8 files changed

+42
-13
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.7.2</build.version>
78+
<build.version>3.7.3</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/commands/admin/AdminRegisterCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ void register(User user, String targetName) {
129129
if (island.isSpawn()) {
130130
getIslands().clearSpawn(island.getWorld());
131131
}
132+
// Remove deletion status if it has been assigned.
133+
island.setDeleted(false);
132134
user.sendMessage("commands.admin.register.registered-island", TextVariables.XYZ,
133135
Util.xyz(island.getCenter().toVector()), TextVariables.NAME, targetName);
134136
user.sendMessage("general.success");
@@ -151,4 +153,4 @@ public Optional<List<String>> tabComplete(User user, String alias, List<String>
151153
return Optional.of(Util.tabLimit(options, lastArg));
152154
}
153155

154-
}
156+
}

src/main/java/world/bentobox/bentobox/api/commands/admin/purge/AdminPurgeRegionsCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ private void findIslands(World world, int days) {
358358

359359
private void displayIsland(Island island) {
360360
// Log the island data
361-
if (island.isDeleted()) {
362-
getPlugin().log("Deleted island at " + Util.xyz(island.getCenter().toVector()) + " in world " + getWorld().getName() + " will be deleted");
361+
if (island.isPurgable()) {
362+
getPlugin().log("Purgable island at " + Util.xyz(island.getCenter().toVector()) + " in world " + getWorld().getName() + " will be deleted");
363363
return;
364364
}
365365
if (island.getOwner() == null) {
@@ -402,8 +402,8 @@ private String formatLocalTimestamp(Long millis) {
402402
* @return true means “cannot delete”
403403
*/
404404
private boolean canDeleteIsland(Island island) {
405-
// If the island is marked for deletion, it can be deleted at any time
406-
if (island.isDeleted()) {
405+
// If the island is purgeable, it can be deleted at any time
406+
if (island.isPurgable()) {
407407
return false;
408408
}
409409
long cutoffMillis = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(days);

src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public boolean canExecute(User user, String label, List<String> args) {
5656
return false;
5757
}
5858
if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) {
59-
user.sendMessage("general.errors.no-island");
59+
user.sendMessage("general.errors.not-owner");
6060
return false;
6161
}
6262
int resetsLeft = getPlayers().getResetsLeft(getWorld(), user.getUniqueId());

src/main/java/world/bentobox/bentobox/database/objects/Island.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public class Island implements DataObject, MetaDataAble {
7171
// True if this island is deleted and pending deletion from the database
7272
@Expose
7373
private boolean deleted = false;
74+
75+
// True if this island is purgable from the database
76+
@Expose
77+
private boolean purgable = false;
7478

7579
@Expose
7680
@NonNull
@@ -267,6 +271,7 @@ public Island(Island island) {
267271
});
268272
this.createdDate = island.getCreatedDate();
269273
this.deleted = island.isDeleted();
274+
this.purgable = island.isPurgable();
270275
this.doNotLoad = island.isDoNotLoad();
271276
this.flags.putAll(island.getFlags());
272277
this.gameMode = island.getGameMode();
@@ -2118,5 +2123,19 @@ public boolean equals(Object obj) {
21182123
return Objects.equals(uniqueId, other.uniqueId);
21192124
}
21202125

2126+
/**
2127+
* @return the purgable
2128+
*/
2129+
public boolean isPurgable() {
2130+
return purgable;
2131+
}
2132+
2133+
/**
2134+
* @param purgable the purgable to set
2135+
*/
2136+
public void setPurgable(boolean purgable) {
2137+
this.purgable = purgable;
2138+
setChanged();
2139+
}
21212140

21222141
}

src/main/java/world/bentobox/bentobox/listeners/teleports/AbstractTeleportListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ protected int calculateSearchRadius(Location location, Island island)
205205
int x = Math.abs(island.getProtectionCenter().getBlockX() - location.getBlockX());
206206
int z = Math.abs(island.getProtectionCenter().getBlockZ() - location.getBlockZ());
207207

208-
diff = Math.min(this.plugin.getSettings().getSafeSpotSearchRange(),
209-
island.getProtectionRange() - Math.max(x, z));
208+
diff = Math.min(this.plugin.getSettings().getMinPortalSearchRadius(),
209+
island.getProtectionRange() + (island.getRange() - island.getProtectionRange())*2 - Math.max(x, z));
210210
}
211211
else
212212
{
213-
diff = this.plugin.getSettings().getSafeSpotSearchRange();
213+
diff = this.plugin.getSettings().getMinPortalSearchRadius();
214214
}
215215

216216
return diff;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public void deleteIsland(@NonNull Island island, boolean removeBlocks, @Nullable
289289
removePlayersFromIsland(island);
290290
// Mark island as deleted
291291
island.setDeleted(true);
292+
// Mark as purgeable
293+
island.setPurgable(true);
292294
if (!plugin.getSettings().isKeepPreviousIslandOnReset()) {
293295
// Remove island from the cache
294296
islandCache.deleteIslandFromCache(island);
@@ -1306,9 +1308,8 @@ public void load() throws IOException {
13061308
if (island.isDeleted()) {
13071309
// These will be deleted later
13081310
deletedIslands.add(island.getUniqueId());
1309-
}
1310-
// Check island distance and if incorrect stop BentoBox
1311-
if (!plugin.getSettings().isOverrideSafetyCheck() && island.getWorld() != null
1311+
} // Check island distance and if incorrect stop BentoBox
1312+
else if (!plugin.getSettings().isOverrideSafetyCheck() && island.getWorld() != null
13121313
&& plugin.getIWM().inWorld(island.getWorld())
13131314
&& island.getRange() != plugin.getIWM().getIslandDistance(island.getWorld())) {
13141315
throw new IOException("Island distance mismatch!\n" + "World '" + island.getWorld().getName()

src/test/java/world/bentobox/bentobox/database/objects/IslandTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,10 +1281,17 @@ public void testIsDeleted() {
12811281
*/
12821282
@Test
12831283
public void testSetDeleted() {
1284+
assertFalse(i.isDeleted());
12841285
i.setDeleted(true);
12851286
assertTrue(i.isDeleted());
12861287
i.setDeleted(false);
12871288
assertFalse(i.isDeleted());
1289+
1290+
assertFalse(i.isPurgable());
1291+
i.setPurgable(true);
1292+
assertTrue(i.isPurgable());
1293+
i.setPurgable(false);
1294+
assertFalse(i.isPurgable());
12881295
}
12891296

12901297
/**

0 commit comments

Comments
 (0)