Skip to content

Commit 8e24e1b

Browse files
committed
Apply changes
1 parent 160b593 commit 8e24e1b

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

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

Lines changed: 21 additions & 16 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(Caption.of("fawe.worldedit.schematic.schematic.saved", filename, (overwrite ? Caption.of("fawe.worldedit.schematic.schematic.overwritten") : ".")), 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(
@@ -1002,9 +1008,7 @@ public Void call() throws Exception {
10021008

10031009
if (numFiles >= limit) {
10041010
LOGGER.info(actor.getName() + " failed to save " + file.getCanonicalPath() + " - too many schematics!");
1005-
actor.print(Caption.of("fawe.error.schematic.over.count.limit", numFiles, limit).color(TextColor.RED));
1006-
throw new WorldEditException(Caption.of("fawe.error.schematic.over.limit", numFiles, limit)) {
1007-
};
1011+
throw new FaweException(Caption.of("fawe.error.schematic.over.limit", numFiles, limit));
10081012
}
10091013
}
10101014
//FAWE end
@@ -1043,10 +1047,12 @@ public Void call() throws Exception {
10431047

10441048
if ((curKb) > allocatedKb) {
10451049
file.delete();
1046-
actor.print(Caption.of("fawe.error.schematic.over.disk.limit", String.format("%.1f", curKb), String.format("%dkb", allocatedKb)).color(TextColor.RED));
10471050
LOGGER.info(actor.getName() + " failed to save " + SCHEMATIC_NAME + " - not enough space!");
1048-
throw new WorldEditException(Caption.of("fawe.error.schematic.over.disk.limit", String.format("%.1f", curKb), String.format("%dkb", allocatedKb))) {
1049-
};
1051+
throw new FaweException(Caption.of(
1052+
"fawe.error.schematic.over.disk.limit",
1053+
String.format("%.1f", curKb),
1054+
String.format("%dkb", allocatedKb)
1055+
));
10501056
}
10511057
if (overwrite) {
10521058
new File(curFilepath).delete();
@@ -1059,7 +1065,6 @@ public Void call() throws Exception {
10591065
}
10601066

10611067
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && actor.getLimit().SCHEM_FILE_NUM_LIMIT > -1) {
1062-
10631068
actor.print(Caption.of("fawe.worldedit.schematic.schematic.slots.free", (actor.getLimit().SCHEM_FILE_NUM_LIMIT - numFiles)));
10641069
}
10651070
LOGGER.info(actor.getName() + " saved " + file.getCanonicalPath());

worldedit-core/src/main/resources/lang/strings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@
6767
"fawe.worldedit.schematic.schematic.move.success": "{0} -> {1}",
6868
"fawe.worldedit.schematic.schematic.move.failed": "{0} no moved: {1}",
6969
"fawe.worldedit.schematic.schematic.loaded": "{0} loaded. Paste it with //paste",
70-
"fawe.worldedit.schematic.schematic.saved": "{0} saved{1}",
71-
"fawe.worldedit.schematic.schematic.overwritten": " (overwriting previous file)",
70+
"fawe.worldedit.schematic.schematic.saved": "{0} saved.",
71+
"fawe.worldedit.schematic.schematic.overwritten": "{0} saved (overwriting previous file).",
7272
"fawe.worldedit.schematic.schematic.none": "No files found.",
7373
"fawe.worldedit.schematic.schematic.load-failure": "File could not be read or it does not exist: {0}. If you are specifying a format, you may not be specifying the correct one. Sponge schematic v2 and v3 both use the .schem file extension. To allow FAWE to select the format, do not specify one. If you are using a litematica schematic, it is not supported!",
74-
"fawe.worldedit.schematic.schematic.size": "{0} size {1} kb",
75-
"fawe.worldedit.schematic.schematic.disk.space": "You have {0} kb left for schematics",
74+
"fawe.worldedit.schematic.schematic.size": "{0} size: {1}kb",
75+
"fawe.worldedit.schematic.schematic.disk.space": "You have {0}kb left for schematics.",
7676
"fawe.worldedit.schematic.schematic.slots.free": "You have {0} schematic file slots left.",
7777
"fawe.worldedit.clipboard.clipboard.uri.not.found": "You do not have {0} loaded",
7878
"fawe.worldedit.clipboard.clipboard.cleared": "Clipboard cleared",
@@ -130,7 +130,7 @@
130130
"fawe.error.invalid-boolean": "Invalid boolean {0}",
131131
"fawe.error.schematic.not.found": "Schematic {0} not found.",
132132
"fawe.error.schematic.over.count.limit": "You have {0}/{1} saved schematics. Delete some to save this one!",
133-
"fawe.error.schematic.over.disk.limit": "You're about to be at {0} kb of schematics {1} available) Delete some first to save this one!",
133+
"fawe.error.schematic.over.disk.limit": "You're about to be at {0}kb of schematics ({1} available). Delete some first to save this one!",
134134
"fawe.error.parse.invalid-dangling-character": "Invalid dangling character {0}.",
135135
"fawe.error.parse.unknown-mask": "Unknown mask: {0}, See: {1}",
136136
"fawe.error.parse.unknown-pattern": "Unknown pattern: {0}, See: {1}",

0 commit comments

Comments
 (0)