Skip to content

Commit 9b4efd5

Browse files
authored
Merge pull request #2706 from BentoBoxWorld/purge-improvements
Purge improvements
2 parents 728d2ea + 6510cbf commit 9b4efd5

File tree

16 files changed

+641
-34
lines changed

16 files changed

+641
-34
lines changed

pom.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<paper.version>1.21.7-R0.1-SNAPSHOT</paper.version>
6767
<bstats.version>3.0.0</bstats.version>
6868
<vault.version>1.7.1</vault.version>
69+
<level.version>2.21.3</level.version>
6970
<placeholderapi.version>2.10.9</placeholderapi.version>
7071
<githubapi.version>d5f5e0bbd8</githubapi.version>
7172
<myworlds.version>1.19.3-v1</myworlds.version>
@@ -74,7 +75,7 @@
7475
<!-- Do not change unless you want different name for local builds. -->
7576
<build.number>-LOCAL</build.number>
7677
<!-- This allows to change between versions. -->
77-
<build.version>3.6.1</build.version>
78+
<build.version>3.7.0</build.version>
7879
<sonar.organization>bentobox-world</sonar.organization>
7980
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
8081
<server.jars>${project.basedir}/lib</server.jars>
@@ -200,6 +201,11 @@
200201
<id>matteodev</id>
201202
<url>https://maven.devs.beer/</url>
202203
</repository>
204+
<!-- BentoBox Addons -->
205+
<repository>
206+
<id>bentoboxworld</id>
207+
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
208+
</repository>
203209
</repositories>
204210

205211
<dependencies>
@@ -409,6 +415,13 @@
409415
<version>2.4.1</version>
410416
<scope>provided</scope>
411417
</dependency>
418+
<!-- Level -->
419+
<dependency>
420+
<groupId>world.bentobox</groupId>
421+
<artifactId>level</artifactId>
422+
<version>${level.version}</version>
423+
<scope>provided</scope>
424+
</dependency>
412425
</dependencies>
413426

414427
<build>

src/main/java/world/bentobox/bentobox/Settings.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ public class Settings implements ConfigObject {
293293
@ConfigComment("resulting amount of chunks that must be loaded to fulfill the process, which often causes the server to hang out.")
294294
@ConfigEntry(path = "island.paste-speed")
295295
private int pasteSpeed = 64;
296+
297+
@ConfigComment("Island Level Purge Protection")
298+
@ConfigComment("Islands above this level will not be purged even if they are old. Requires the Level Addon.")
299+
@ConfigComment("If the Level addon is not present, this will not be checked.")
300+
@ConfigEntry(path = "island.purge-level")
301+
private int islandPurgeLevel = 10;
296302

297303
@ConfigComment("Island deletion: Number of chunks per world to regenerate per second.")
298304
@ConfigComment("If there is a nether and end then 3x this number will be regenerated per second.")
@@ -1075,4 +1081,18 @@ public void setClickCooldownMs(long clickCooldownMs) {
10751081
this.clickCooldownMs = clickCooldownMs;
10761082
}
10771083

1084+
/**
1085+
* @return the islandPurgeLevel
1086+
*/
1087+
public int getIslandPurgeLevel() {
1088+
return islandPurgeLevel;
1089+
}
1090+
1091+
/**
1092+
* @param islandPurgeLevel the islandPurgeLevel to set
1093+
*/
1094+
public void setIslandPurgeLevel(int islandPurgeLevel) {
1095+
this.islandPurgeLevel = islandPurgeLevel;
1096+
}
1097+
10781098
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void setup() {
4747
new AdminPurgeStopCommand(this);
4848
new AdminPurgeUnownedCommand(this);
4949
new AdminPurgeProtectCommand(this);
50+
new AdminPurgeRegionsCommand(this);
5051
}
5152

5253
@Override
@@ -167,7 +168,7 @@ CompletableFuture<Set<String>> getOldIslands(int days) {
167168
user.sendMessage("commands.admin.purge.total-islands", TextVariables.NUMBER, String.valueOf(list.size()));
168169
Set<String> oldIslands = new HashSet<>();
169170
list.stream()
170-
.filter(i -> !i.isSpawn()).filter(i -> !i.getPurgeProtected())
171+
.filter(i -> !i.isSpawn()).filter(i -> !i.isPurgeProtected())
171172
.filter(i -> i.getWorld() != null) // to handle currently unloaded world islands
172173
.filter(i -> i.getWorld().equals(this.getWorld())) // Island needs to be in this world
173174
.filter(Island::isOwned) // The island needs to be owned

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public boolean canExecute(User user, String label, List<String> args) {
4141

4242
@Override
4343
public boolean execute(User user, String label, List<String> args) {
44-
island.setPurgeProtected(!island.getPurgeProtected());
45-
if (island.getPurgeProtected()) {
44+
island.setPurgeProtected(!island.isPurgeProtected());
45+
if (island.isPurgeProtected()) {
4646
user.sendMessage("commands.admin.purge.protect.protecting");
4747
} else {
4848
user.sendMessage("commands.admin.purge.protect.unprotecting");

0 commit comments

Comments
 (0)