diff --git a/src/main/java/shit/zen/ZenClient.java b/src/main/java/shit/zen/ZenClient.java index e82c794..7389fbe 100644 --- a/src/main/java/shit/zen/ZenClient.java +++ b/src/main/java/shit/zen/ZenClient.java @@ -3,6 +3,10 @@ package shit.zen; import asm.patchify.loader.PatchAgent; import asm.patchify.loader.PatchRegistry; import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.lang.reflect.Field; import lombok.Getter; import lombok.Setter; @@ -55,6 +59,8 @@ public class ZenClient extends ClientBase { public static String configDir = System.getProperty("user.home") + File.separator + ".zen"; public static String username = ""; + private static final String[] CLOUD_ASSET_NAMES = { "panel.png", "ptr.png", "lie.wav", "truth.wav" }; + private EventBus eventBus; private RotationHandler rotationHandler; private ModuleManager moduleManager; @@ -87,6 +93,7 @@ public class ZenClient extends ClientBase { this.hudManager = new HudManager(); this.commandManager = new CommandManager(); this.configManager = new ConfigManager(); + this.extractCloudAssets(); this.lagManager = new LagManager(); this.targetManager = new TargetManager(); this.eventBus.register(this.hudManager); @@ -140,6 +147,29 @@ public class ZenClient extends ClientBase { } } + private void extractCloudAssets() { + File targetDir = ConfigManager.CONFIG_DIR; + if (!targetDir.exists() && !targetDir.mkdirs()) { + logger.warn("Failed to create config directory at {}", targetDir); + return; + } + for (String name : CLOUD_ASSET_NAMES) { + File outFile = new File(targetDir, name); + if (outFile.exists()) continue; + try (InputStream in = ZenClient.class.getResourceAsStream("/assets/zen/cloud_assets/" + name)) { + if (in == null) { + logger.warn("Cloud asset missing on classpath: {}", name); + continue; + } + try (OutputStream out = new FileOutputStream(outFile)) { + in.transferTo(out); + } + } catch (IOException ioException) { + logger.error("Failed to extract cloud asset {}", name, ioException); + } + } + } + private static void registerPatches() { PatchRegistry.register(MinecraftPatch.class); PatchRegistry.register(LocalPlayerPatch.class); diff --git a/src/main/java/shit/zen/utils/ByteCipher.java b/src/main/java/shit/zen/utils/ByteCipher.java deleted file mode 100644 index dbd313a..0000000 --- a/src/main/java/shit/zen/utils/ByteCipher.java +++ /dev/null @@ -1,32 +0,0 @@ -package shit.zen.utils; - -import java.security.SecureRandom; -import java.util.Arrays; - -public class ByteCipher { - private final byte[] key; - - public ByteCipher(byte[] keyBytes) { - this.key = Arrays.copyOf(keyBytes, keyBytes.length); - } - - public byte[] encrypt(byte[] input, int shift) { - byte[] output = new byte[input.length]; - for (int i = 0; i < input.length; ++i) { - output[i] = (byte)(input[i] + this.key[i % this.key.length] + shift); - } - return output; - } - - public byte[] decrypt(byte[] input, int shift) { - byte[] output = new byte[input.length]; - for (int i = 0; i < input.length; ++i) { - output[i] = (byte)(input[i] - this.key[i % this.key.length] - shift); - } - return output; - } - - static { - new SecureRandom(); - } -} \ No newline at end of file