diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-06 20:25:55 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-06 20:25:55 +0200 |
commit | 1e6e88be3a9d5660ccd667b5734dc7c4a1442966 (patch) | |
tree | 3a734cecbffbf4e0148f74c1c48f3dc42f5841c8 /src/main/java/at/hannibal2/skyhanni | |
parent | e9ed2d6ba7dc3173e92649c504c7b6d821bcfe29 (diff) | |
download | skyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.tar.gz skyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.tar.bz2 skyhanni-1e6e88be3a9d5660ccd667b5734dc7c4a1442966.zip |
Added command logging
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
4 files changed, 43 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 |