Skip to content

Commit

Permalink
Added debug command because hypixel likes to do some weird stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Dec 7, 2021
1 parent 0374f4d commit 162535c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/kotlin/tech/thatgravyboat/rewardclaim/Command.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ 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") {

@DefaultHandler
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
}
}
10 changes: 9 additions & 1 deletion src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 162535c

Please sign in to comment.