aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
blob: eb9ea503eabf348bb098e3a6f2f7eba37c3bb5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package at.hannibal2.skyhanni.features.commands

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.network.play.client.C01PacketChatMessage
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class WarpIsCommand {

    @SubscribeEvent
    fun onSendPacket(event: PacketEvent.SendEvent) {
        if (!LorenzUtils.inSkyBlock) return
        if (!SkyHanniMod.feature.commands.replaceWarpIs) return

        val packet = event.packet
        if (packet is C01PacketChatMessage && packet.message.lowercase() == "/warp is") {
            event.isCanceled = true
            LorenzUtils.sendMessageToServer("/is")
        }
    }
}