aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-06 20:25:55 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-06 20:25:55 +0200
commit1e6e88be3a9d5660ccd667b5734dc7c4a1442966 (patch)
tree3a734cecbffbf4e0148f74c1c48f3dc42f5841c8 /src
parente9ed2d6ba7dc3173e92649c504c7b6d821bcfe29 (diff)
downloadskyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.tar.gz
skyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.tar.bz2
skyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.zip
Added command logging
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityPlayerSPHook.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayerSP.java17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt13
-rw-r--r--src/main/resources/mixins.skyhanni.json1
5 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
index 7bc48d2e7..d94d3a39a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
@@ -26,6 +26,12 @@ public class DevData {
public boolean debugEnabled = false;
@Expose
+ @ConfigOption(name = "Command Logging", desc = "Logs stack trace information into the console when a command gets sent to hypixel. (by any mod or the player)")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean commandLogs = false;
+
+ @Expose
public Position debugPos = new Position(10, 10, false, true);
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityPlayerSPHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityPlayerSPHook.kt
new file mode 100644
index 000000000..ea115119f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityPlayerSPHook.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.mixins.hooks
+
+import at.hannibal2.skyhanni.test.CommandsSendToServerLogger
+
+fun sendChatMessage(message: String) {
+ CommandsSendToServerLogger.logCommandsToServer(message)
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayerSP.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayerSP.java
new file mode 100644
index 000000000..db41c5cce
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayerSP.java
@@ -0,0 +1,17 @@
+package at.hannibal2.skyhanni.mixins.transformers;
+
+import at.hannibal2.skyhanni.mixins.hooks.EntityPlayerSPHookKt;
+import net.minecraft.client.entity.EntityPlayerSP;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(EntityPlayerSP.class)
+public class MixinEntityPlayerSP {
+
+ @Inject(method = "sendChatMessage", at = @At(value = "HEAD"))
+ private void sendChatMessage_inject(String message, CallbackInfo ci) {
+ EntityPlayerSPHookKt.sendChatMessage(message);
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt
new file mode 100644
index 000000000..d7403c626
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt
@@ -0,0 +1,13 @@
+package at.hannibal2.skyhanni.test
+
+import at.hannibal2.skyhanni.SkyHanniMod
+
+class CommandsSendToServerLogger {
+ companion object {
+ fun logCommandsToServer(command: String) {
+ if (SkyHanniMod.feature.dev.commandLogs) {
+ Exception("command send to server: '$command'").printStackTrace()
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json
index 41fa37979..91b8b21ff 100644
--- a/src/main/resources/mixins.skyhanni.json
+++ b/src/main/resources/mixins.skyhanni.json
@@ -7,6 +7,7 @@
"MixinBlockFire",
"MixinEntityBlaze",
"MixinEntityFireball",
+ "MixinEntityPlayerSP",
"MixinNetHandlerPlayClient",
"MixinNetworkManager",
"MixinRenderItem",