|
4 | 4 | import com.google.gson.JsonObject; |
5 | 5 | import com.ldtteam.structurize.Structurize; |
6 | 6 | import com.ldtteam.structurize.api.Log; |
| 7 | +import com.ldtteam.structurize.api.Utils; |
7 | 8 | import com.ldtteam.structurize.api.constants.Constants; |
8 | 9 | import com.ldtteam.structurize.network.messages.NotifyServerAboutStructurePacksMessage; |
9 | 10 | import com.ldtteam.structurize.network.messages.SyncSettingsToServer; |
@@ -101,7 +102,7 @@ public static void onClientLoading() |
101 | 102 | Files.createDirectory(outputPath); |
102 | 103 | } |
103 | 104 |
|
104 | | - final Path clientPackPath = outputPath.resolve(Minecraft.getInstance().getUser().getName().toLowerCase(Locale.US)); |
| 105 | + final Path clientPackPath = outputPath.resolve(Utils.getSafePackName(Minecraft.getInstance().getUser().getName()).toLowerCase(Locale.US)); |
105 | 106 | if (!Files.exists(clientPackPath)) |
106 | 107 | { |
107 | 108 | Files.createDirectory(clientPackPath); |
@@ -345,12 +346,12 @@ public static Path zipSlipProtect(ZipEntry zipEntry, Path targetDir) throws IOEx |
345 | 346 | */ |
346 | 347 | public static void handleSaveScanMessage(final CompoundTag compound, final String fileName, final HolderLookup.Provider provider) |
347 | 348 | { |
348 | | - final String packName = Minecraft.getInstance().getUser().getName().toLowerCase(Locale.US); |
349 | | - StructurePacks.switchSelectedPack(StructurePacks.getStructurePack(Minecraft.getInstance().getUser().getName())); |
| 349 | + final String packName = Utils.getSafePackName(Minecraft.getInstance().getUser().getName()); |
| 350 | + StructurePacks.switchSelectedPack(StructurePacks.getStructurePack(Utils.getSafePackName(Minecraft.getInstance().getUser().getName()))); |
350 | 351 | RenderingCache.getOrCreateBlueprintPreviewData("blueprint").setBlueprintFuture( |
351 | 352 | StructurePacks.storeBlueprint(packName, compound, Minecraft.getInstance().gameDirectory.toPath() |
352 | 353 | .resolve(BLUEPRINT_FOLDER) |
353 | | - .resolve(Minecraft.getInstance().getUser().getName().toLowerCase(Locale.US)) |
| 354 | + .resolve(packName.toLowerCase(Locale.US)) |
354 | 355 | .resolve(SCANS_FOLDER).resolve(fileName), provider)); |
355 | 356 | RenderingCache.getOrCreateBlueprintPreviewData("blueprint").setPos(null); |
356 | 357 | Minecraft.getInstance().player.displayClientMessage(Component.translatable("Scan successfully saved as %s", fileName), false); |
|
0 commit comments