Skip to content

Commit 160f8af

Browse files
committed
Merge branch 'main' into feat/mc-26.1
# Conflicts: # gradle/libs.versions.toml
2 parents 34352d7 + 6371c5e commit 160f8af

11 files changed

Lines changed: 60 additions & 76 deletions

File tree

.github/workflows/build-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Checkout Repository
1212
uses: actions/checkout@v6
1313
- name: Validate Gradle Wrapper
14-
uses: gradle/actions/wrapper-validation@v5
14+
uses: gradle/actions/wrapper-validation@v6
1515
- name: Setup Java
1616
uses: actions/setup-java@v5
1717
with:

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Checkout Repository
1212
uses: actions/checkout@v6
1313
- name: Validate Gradle Wrapper
14-
uses: gradle/actions/wrapper-validation@v5
14+
uses: gradle/actions/wrapper-validation@v6
1515
- name: Setup Java
1616
uses: actions/setup-java@v5
1717
with:

.github/workflows/upload-release-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: Checkout Repository
1010
uses: actions/checkout@v6
1111
- name: Validate Gradle Wrapper
12-
uses: gradle/actions/wrapper-validation@v5
12+
uses: gradle/actions/wrapper-validation@v6
1313
- name: Setup Java
1414
uses: actions/setup-java@v5
1515
with:

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ worldguard-bukkit = "7.0.15"
1313
griefprevention = "18.0.0"
1414
griefdefender = "2.1.0-SNAPSHOT"
1515
residence = "6.0.0.1"
16-
towny = "0.102.0.12"
16+
towny = "0.102.0.14"
1717
plotsquared = "7.5.12"
1818

1919
# Third party
2020
bstats = "3.2.1"
2121
sparsebitset = "1.3"
2222
parallelgzip = "1.0.5"
2323
adventure = "4.26.1"
24-
checkerqual = "3.54.0"
24+
checkerqual = "4.1.0"
2525
truezip = "6.8.4"
2626
auto-value = "1.11.1"
2727
jsr305 = "3.0.2"
@@ -31,7 +31,7 @@ antlr4 = "4.13.2"
3131
json-simple = "1.1.1"
3232
jlibnoise = "1.0.0"
3333
jchronic = "0.2.4a"
34-
lz4-java = "1.10.4"
34+
lz4-java = "1.11.0"
3535
commons-cli = "1.11.0"
3636
paperLib = "1.0.8"
3737
paster = "1.1.7"

gradle/wrapper/gradle-wrapper.jar

-504 Bytes
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip
44
networkTimeout=10000
5+
retries=0
6+
retryBackOffMs=500
57
validateDistributionUrl=true
68
zipStoreBase=GRADLE_USER_HOME
79
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 10 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.util.concurrent.LinkedBlockingQueue;
4444
import java.util.concurrent.ThreadPoolExecutor;
4545
import java.util.concurrent.TimeUnit;
46+
import java.util.concurrent.atomic.AtomicLong;
4647

4748
/**
4849
* [ WorldEdit action ]
@@ -413,26 +414,31 @@ private void setupMemoryListener() {
413414
final MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
414415
final NotificationEmitter ne = (NotificationEmitter) memBean;
415416

417+
AtomicLong lastWarn = new AtomicLong(System.currentTimeMillis());
416418
ne.addNotificationListener((notification, handback) -> {
417419
final long heapSize = Runtime.getRuntime().totalMemory();
418420
final long heapMaxSize = Runtime.getRuntime().maxMemory();
419421
if (heapSize < heapMaxSize) {
420422
return;
421423
}
422-
LOGGER.warn("High memory usage detected, FAWE will attempt to slow operations to prevent a crash.");
424+
final long time = System.currentTimeMillis();
425+
if (time > lastWarn.get() + TimeUnit.SECONDS.toMillis(30)) {
426+
lastWarn.set(time);
427+
LOGGER.warn("High memory usage detected, FAWE will attempt to slow operations to prevent a crash.");
428+
}
423429
MemUtil.memoryLimitedTask();
424430
}, null, null);
425431

426432
final List<MemoryPoolMXBean> memPools = ManagementFactory.getMemoryPoolMXBeans();
427433
for (final MemoryPoolMXBean mp : memPools) {
428-
if (mp.isUsageThresholdSupported()) {
434+
if (mp.isCollectionUsageThresholdSupported()) {
429435
final MemoryUsage mu = mp.getUsage();
430436
final long max = mu.getMax();
431437
if (max < 0) {
432438
continue;
433439
}
434440
final long alert = (max * Settings.settings().MAX_MEMORY_PERCENT) / 100;
435-
mp.setUsageThreshold(alert);
441+
mp.setCollectionUsageThreshold(alert);
436442
}
437443
}
438444
} catch (Throwable ignored) {

worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.fastasyncworldedit.core.event.extent.ActorSaveClipboardEvent;
2525
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
2626
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
27+
import com.fastasyncworldedit.core.internal.exception.FaweException;
2728
import com.fastasyncworldedit.core.math.transform.MutatingOperationTransformHolder;
2829
import com.fastasyncworldedit.core.util.MainUtil;
2930
import com.google.common.collect.Multimap;
@@ -576,15 +577,20 @@ public void save(
576577
ClipboardHolder holder = session.getClipboard();
577578

578579
SchematicSaveTask task = new SchematicSaveTask(actor, f, dir, format, holder, overwrite);
579-
AsyncCommandBuilder.wrap(task, actor)
580-
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
581-
.setDelayMessage(Caption.of("worldedit.schematic.save.saving"))
582-
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
583-
.onFailure(
584-
Caption.of("worldedit.schematic.failed-to-save"),
585-
worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter()
586-
)
587-
.buildAndExec(worldEdit.getExecutorService());
580+
AsyncCommandBuilder
581+
.wrap(task, actor)
582+
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
583+
.setDelayMessage(Caption.of("worldedit.schematic.save.saving"))
584+
.onSuccess(
585+
overwrite
586+
? Caption.of("fawe.worldedit.schematic.schematic.overwritten")
587+
: Caption.of("fawe.worldedit.schematic.schematic.saved", filename), null
588+
)
589+
.onFailure(
590+
Caption.of("worldedit.schematic.failed-to-save"),
591+
worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter()
592+
)
593+
.buildAndExec(worldEdit.getExecutorService());
588594
}
589595

590596
@Command(
@@ -1001,14 +1007,8 @@ public Void call() throws Exception {
10011007
int limit = actor.getLimit().SCHEM_FILE_NUM_LIMIT;
10021008

10031009
if (numFiles >= limit) {
1004-
TextComponent noSlotsErr = TextComponent.of( //TODO - to be moved into captions/translatablecomponents
1005-
String.format(
1006-
"You have " + numFiles + "/" + limit + " saved schematics. Delete some to save this one!",
1007-
TextColor.RED
1008-
));
10091010
LOGGER.info(actor.getName() + " failed to save " + file.getCanonicalPath() + " - too many schematics!");
1010-
throw new WorldEditException(noSlotsErr) {
1011-
};
1011+
throw new FaweException(Caption.of("fawe.error.schematic.over.limit", numFiles, limit));
10121012
}
10131013
}
10141014
//FAWE end
@@ -1034,9 +1034,7 @@ public Void call() throws Exception {
10341034
closer.close(); // release the new .schem file so that its size can be measured
10351035
double filesizeKb = Files.size(Paths.get(file.getAbsolutePath())) / 1000.0;
10361036

1037-
TextComponent filesizeNotif = TextComponent.of( //TODO - to be moved into captions/translatablecomponents
1038-
SCHEMATIC_NAME + " size: " + String.format("%.1f", filesizeKb) + "kb", TextColor.GRAY);
1039-
actor.print(filesizeNotif);
1037+
actor.print(Caption.of("fawe.worldedit.schematic.schematic.size", SCHEMATIC_NAME, String.format("%.1f", filesizeKb)));
10401038

10411039
if (checkFilesize) {
10421040

@@ -1049,42 +1047,25 @@ public Void call() throws Exception {
10491047

10501048
if ((curKb) > allocatedKb) {
10511049
file.delete();
1052-
TextComponent notEnoughKbErr = TextComponent.of(
1053-
//TODO - to be moved into captions/translatablecomponents
1054-
"You're about to be at " + String.format("%.1f", curKb) + "kb of schematics. ("
1055-
+ String.format(
1056-
"%dkb",
1057-
allocatedKb
1058-
) + " available) Delete some first to save this one!",
1059-
TextColor.RED
1060-
);
10611050
LOGGER.info(actor.getName() + " failed to save " + SCHEMATIC_NAME + " - not enough space!");
1062-
throw new WorldEditException(notEnoughKbErr) {
1063-
};
1051+
throw new FaweException(Caption.of(
1052+
"fawe.error.schematic.over.disk.limit",
1053+
String.format("%.1f", curKb),
1054+
String.format("%dkb", allocatedKb)
1055+
));
10641056
}
10651057
if (overwrite) {
10661058
new File(curFilepath).delete();
10671059
file.renameTo(new File(curFilepath));
10681060
} else {
10691061
numFiles++;
10701062
}
1071-
TextComponent kbRemainingNotif = TextComponent.of(
1072-
//TODO - to be moved into captions/translatablecomponents
1073-
"You have " + String.format("%.1f", (allocatedKb - curKb)) + "kb left for schematics.",
1074-
TextColor.GRAY
1075-
);
1076-
actor.print(kbRemainingNotif);
1063+
1064+
actor.print(Caption.of("fawe.worldedit.schematic.schematic.disk.space", String.format("%.1f", (allocatedKb - curKb))));
10771065
}
10781066

10791067
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && actor.getLimit().SCHEM_FILE_NUM_LIMIT > -1) {
1080-
1081-
TextComponent slotsRemainingNotif = TextComponent.of(
1082-
//TODO - to be moved into captions/translatablecomponents
1083-
"You have " + (actor.getLimit().SCHEM_FILE_NUM_LIMIT - numFiles)
1084-
+ " schematic file slots left.",
1085-
TextColor.GRAY
1086-
);
1087-
actor.print(slotsRemainingNotif);
1068+
actor.print(Caption.of("fawe.worldedit.schematic.schematic.slots.free", (actor.getLimit().SCHEM_FILE_NUM_LIMIT - numFiles)));
10881069
}
10891070
LOGGER.info(actor.getName() + " saved " + file.getCanonicalPath());
10901071
} else {

0 commit comments

Comments
 (0)