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