diff options
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt index ac1f087..97cc75a 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt @@ -3,6 +3,7 @@ package tech.thatgravyboat.rewardclaim import gg.essential.api.EssentialAPI import gg.essential.api.commands.Command import gg.essential.api.commands.DefaultHandler +import gg.essential.api.commands.SubCommand class Command : Command("rewardclaim") { @@ -10,4 +11,9 @@ class Command : Command("rewardclaim") { fun handle() { EssentialAPI.getGuiUtil().openScreen(Config.gui()) } + + @SubCommand("debug", description = "Toggles debug mode, do not turn this unless told otherwise by a dev.") + fun debugMode() { + RewardClaim.debugMode = !RewardClaim.debugMode + } } diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt index d4ba80b..db80e14 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt @@ -20,11 +20,12 @@ import tech.thatgravyboat.rewardclaim.ui.RewardClaimGui object RewardClaim { private var rewardClaimTime: Long = 0 + var debugMode = false @Mod.EventHandler fun onFMLInitialization(event: FMLInitializationEvent?) { MinecraftForge.EVENT_BUS.register(this) - EssentialAPI.getCommandRegistry().registerCommand(Command()) + Command().register() } @Mod.EventHandler @@ -64,6 +65,13 @@ object RewardClaim { @SubscribeEvent fun onScreen(event: GuiOpenEvent) { + if (debugMode) { + println("-------------------------------------------------------------------------------") + println("[Reward Claim Debug] : Current Screen = ${EssentialAPI.getGuiUtil().openedScreen()?.javaClass?.name ?: "null"}") + println("[Reward Claim Debug] : Screen = ${event.gui?.javaClass?.name ?: "null"}") + println("[Reward Claim Debug] : Reward Time = $rewardClaimTime") + println("-------------------------------------------------------------------------------") + } if (EssentialAPI.getGuiUtil().openedScreen() is RewardClaimGui && event.gui is GuiScreenBook && System.currentTimeMillis() - rewardClaimTime <= 3000 |