From 593e7ba2a54cff814822a3293395ce1420f2b9b3 Mon Sep 17 00:00:00 2001 From: R2VvcmdlUk5H <81434111+GeorgeRNG@users.noreply.github.com> Date: Tue, 10 May 2022 19:36:35 +0100 Subject: [PATCH] Feels like it works. --- README.md | 19 ++++++++++++++++--- .../getactiondump/ActionDumpOverScreen.java | 1 + .../dev/dfonline/getactiondump/database.java | 8 ++++++++ .../getactiondump/mixin/ChatMessage.java | 4 ++-- .../mixin/MinecraftDisconnection.java | 12 ++++++++---- .../dfonline/getactiondump/mixin/onExit.java | 4 ++-- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index dffac7c..4553d1c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,21 @@ # Get Action Dump +This took too long to make. ## How to use + +I connect to df with an alternate IP (**54.39.130.89**) since it seemed to diconnect me less. Go onto Node Beta (or any other development node) and run `/actiondump [colours]` \(\[colours\] replaces the colours with & codes.\) -There also is `/reportkeepalives `, which doing the above command might work better after it reports a keepAlive. However doing /actiondump immediately on join might be better then that. +Wait for it to complete. There are roughly **87180 lines** and it takes me ***77 seconds*** to complete. + +## After complete + +Once it is complete, you will be disconnected and sent to a custom menu. +It has three options: +**Main Menu**: Sends you to the Main Menu. +**Copy Data**: Copies the data exported to the actiondump (or error data if it's an error screen) +**Copy Path**: Copies the path in which getactiondump uses. + +The info is put into the `.minecraft/getactiondump`. +The database is put into `db.json`. + -The info is put into the `.minecraft/getactiondump`. -Running the actiondump command is buggy, but doesn't do anything if dumpactioninfo like messages aren't seen. diff --git a/src/main/java/dev/dfonline/getactiondump/ActionDumpOverScreen.java b/src/main/java/dev/dfonline/getactiondump/ActionDumpOverScreen.java index 79973ca..3a2baa7 100644 --- a/src/main/java/dev/dfonline/getactiondump/ActionDumpOverScreen.java +++ b/src/main/java/dev/dfonline/getactiondump/ActionDumpOverScreen.java @@ -45,6 +45,7 @@ protected void init() { this.addDrawableChild(new ButtonWidget(GoodX, Math.min(GoodY + 9, this.height - 30), 200, 20, new LiteralText("Main Menu"), (button) -> { assert this.client != null; this.client.setScreen(this.parent); + GetActionDump.DisconnectMenu = null; })); this.addDrawableChild(new ButtonWidget(GoodX, Math.min(GoodY + 9, this.height - 30) + ((20)), 200, 20, new LiteralText("Copy Data"), (button -> new Clipboard().setClipboard(0, clipboard)))); this.addDrawableChild(new ButtonWidget(GoodX, Math.min(GoodY + 9, this.height - 30) + ((20 * 2)), 200, 20, new LiteralText("Copy Path"), (button -> new Clipboard().setClipboard(0, FileManager.Path().toString())))); diff --git a/src/main/java/dev/dfonline/getactiondump/database.java b/src/main/java/dev/dfonline/getactiondump/database.java index 7b48786..a02c456 100644 --- a/src/main/java/dev/dfonline/getactiondump/database.java +++ b/src/main/java/dev/dfonline/getactiondump/database.java @@ -26,4 +26,12 @@ public static void addData(String data){ public static void save() throws IOException{ FileManager.WriteFile("db.json",Data.replaceAll("\\n$","")); } + + public void close(){ + GetActionDump.overlayText = new String[]{}; + GetActionDump.reportKeepAlives = false; + if(GetActionDump.db != null){ + GetActionDump.db = null; + } + } } diff --git a/src/main/java/dev/dfonline/getactiondump/mixin/ChatMessage.java b/src/main/java/dev/dfonline/getactiondump/mixin/ChatMessage.java index f187f53..1de9efb 100644 --- a/src/main/java/dev/dfonline/getactiondump/mixin/ChatMessage.java +++ b/src/main/java/dev/dfonline/getactiondump/mixin/ChatMessage.java @@ -39,7 +39,7 @@ private void OnChatMessage(GameMessageS2CPacket packet, CallbackInfo ci){ "§eLines: §b" + database.Lines + "\n§eSize: §b" + database.Length + "\n§eTime: §b" + ((float)(System.currentTimeMillis() - database.startTime.getTime()) / 1000) + - "\n§eThe file can be found in: §b" + FileManager.Path() + "\n§eThe file can be found in:\n§b" + FileManager.Path() ),database.Data)); } catch(IOException e){ // an error @@ -48,7 +48,7 @@ private void OnChatMessage(GameMessageS2CPacket packet, CallbackInfo ci){ ),e.getMessage() + "\n" + e.getStackTrace())); LOGGER.error(e.getMessage()); } - db = null; + db.close(); } } else { // for starting the actiondump diff --git a/src/main/java/dev/dfonline/getactiondump/mixin/MinecraftDisconnection.java b/src/main/java/dev/dfonline/getactiondump/mixin/MinecraftDisconnection.java index ca9fbfb..c4be2c1 100644 --- a/src/main/java/dev/dfonline/getactiondump/mixin/MinecraftDisconnection.java +++ b/src/main/java/dev/dfonline/getactiondump/mixin/MinecraftDisconnection.java @@ -13,10 +13,14 @@ public class MinecraftDisconnection { private void tick(CallbackInfo ci){ if(GetActionDump.DisconnectMenu != null){ ci.cancel(); - assert GetActionDump.MC.world != null; - GetActionDump.MC.world.disconnect(); - GetActionDump.MC.disconnect(GetActionDump.DisconnectMenu); - GetActionDump.DisconnectMenu = null; + if(GetActionDump.MC.world != null){ + GetActionDump.MC.world.disconnect(); + GetActionDump.MC.disconnect(GetActionDump.DisconnectMenu); + if(GetActionDump.db != null){ + GetActionDump.db.close(); + } + GetActionDump.DisconnectMenu = null; + } } } } diff --git a/src/main/java/dev/dfonline/getactiondump/mixin/onExit.java b/src/main/java/dev/dfonline/getactiondump/mixin/onExit.java index 6ef0648..121183a 100644 --- a/src/main/java/dev/dfonline/getactiondump/mixin/onExit.java +++ b/src/main/java/dev/dfonline/getactiondump/mixin/onExit.java @@ -11,8 +11,8 @@ public class onExit { @Inject(method = "disconnect", at = @At("HEAD")) public void disconnect(CallbackInfo ci){ - if(GetActionDump.DisconnectMenu == null){ - GetActionDump.db = null; + if(GetActionDump.DisconnectMenu == null && GetActionDump.db != null){ + GetActionDump.db.close(); } } }