refactor: drop Encryption, fix init order, simplify shutdown

- Remove unused Encryption class (AES wrapper around shit.zen.utils)
  and its construction from ZenClient bootstrap; drop dead TimerPatch
  import.
- Defer ConfigManager.loadAll() and CommandManager.initCommands() so
  configs load only after modules are registered, fixing values that
  were silently discarded.
- Make isOwner() return true so the local user is treated as owner.
- Rename ZenClient.disconnectFromServer() to shutdown() and pin the
  MinecraftPatch close hook to At.Type.HEAD so it runs before the
  game tears down its subsystems.
- README: invite users to file issues / open PRs for missing features.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Shirona1337andClaude Opus 4.7 committed 2026-05-21 21:23:39 +08:00
1 parent 38a9137691
commit 797f1f3d33
4 files changed
+8 -55

No files matched your search

+5 -9
View File
@@ -38,8 +38,6 @@ import shit.zen.patch.MinecraftPatch;
import shit.zen.patch.PacketUtilsPatch;
import shit.zen.patch.PlayerPatch;
import shit.zen.patch.PlayerTabOverlayPatch;
import shit.zen.patch.TimerPatch;
import shit.zen.utils.misc.Encryption;
import shit.zen.utils.rotation.RotationHandler;
@Mod(value = "hey")
@@ -64,7 +62,6 @@ public class ZenClient extends ClientBase {
private HudManager hudManager;
private LagManager lagManager;
private TargetManager targetManager;
private Encryption encryption;
private int reconnectAttempts;
public ZenClient() {
@@ -88,15 +85,13 @@ public class ZenClient extends ClientBase {
this.moduleManager = new ModuleManager();
this.hudManager = new HudManager();
this.commandManager = new CommandManager();
this.commandManager.initCommands();
this.configManager = new ConfigManager();
this.configManager.loadAll();
this.lagManager = new LagManager();
this.eventBus.register(this.lagManager);
this.targetManager = new TargetManager();
this.eventBus.register(this.lagManager);
this.eventBus.register(this.targetManager);
this.eventBus.register(this);
this.encryption = new Encryption(Encryption.Algorithm.AES);
this.commandManager.initCommands();
registerPatches();
if (PatchAgent.getInstrumentation() != null) {
PatchAgent.installPatchesAndRetransform();
@@ -117,6 +112,7 @@ public class ZenClient extends ClientBase {
if (isReady() && !moduleInit) {
moduleInit = true;
this.moduleManager.initModules();
this.configManager.loadAll();
}
}
@@ -131,10 +127,10 @@ public class ZenClient extends ClientBase {
}
public static boolean isOwner(String username) {
return false;
return true;
}
public void disconnectFromServer() {
public void shutdown() {
isReady = false;
if (this.configManager != null) {
this.configManager.saveAll();
@@ -70,11 +70,9 @@ public class MinecraftPatch {
}
}
@Inject(method = "close", desc = "()V")
@Inject(method = "close", desc = "()V", at = @At(At.Type.HEAD))
public static void onClose(Minecraft minecraft, CallbackInfo callbackInfo) {
if (ZenClient.isReady()) {
ZenClient.getInstance().disconnectFromServer();
}
ZenClient.getInstance().shutdown();
}
@Inject(method = "setLevel", desc = "(Lnet/minecraft/client/multiplayer/ClientLevel;)V")
@@ -1,41 +0,0 @@
package shit.zen.utils.misc;
import shit.zen.utils.ByteCipher;
public class Encryption {
public enum Algorithm {
AES(new byte[16]),
DES(new byte[8]);
public final byte[] iv;
Algorithm(byte[] iv) {
this.iv = iv;
}
}
private final ByteCipher cipher;
public final Algorithm algo;
public int keyLength = 0;
public Encryption(Algorithm algorithm) {
this.algo = algorithm;
this.cipher = new ByteCipher(algorithm.iv);
}
public String encryptString(String s) throws Exception {
return s;
}
public byte[] encryptBytes(byte[] b) throws Exception {
return b;
}
public String decryptString(String s) throws Exception {
return s;
}
public byte[] decryptBytes(byte[] b) throws Exception {
return b;
}
}