diff options
Diffstat (limited to 'src')
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", |