2424import com .fastasyncworldedit .core .event .extent .ActorSaveClipboardEvent ;
2525import com .fastasyncworldedit .core .extent .clipboard .MultiClipboardHolder ;
2626import com .fastasyncworldedit .core .extent .clipboard .URIClipboardHolder ;
27+ import com .fastasyncworldedit .core .internal .exception .FaweException ;
2728import com .fastasyncworldedit .core .math .transform .MutatingOperationTransformHolder ;
2829import com .fastasyncworldedit .core .util .MainUtil ;
2930import 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