summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThatGravyBoat <thatgravyboat@gmail.com>2021-12-07 17:00:03 -0330
committerThatGravyBoat <thatgravyboat@gmail.com>2021-12-07 17:00:03 -0330
commit162535c3143e5ad4a431ac7d2f6cd93639a3e52c (patch)
tree18313a565194f6e9e27abe991f0bd4b3ab0824ca /src/main
parent0374f4d99285dcd364db20aaf00efb40852b2a7d (diff)
downloadRewardClaim-162535c3143e5ad4a431ac7d2f6cd93639a3e52c.tar.gz
RewardClaim-162535c3143e5ad4a431ac7d2f6cd93639a3e52c.tar.bz2
RewardClaim-162535c3143e5ad4a431ac7d2f6cd93639a3e52c.zip
Added debug command because hypixel likes to do some weird stuff
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt6
-rw-r--r--src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt10
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