[fix] Disable FakePlayer on death

#closes 1615
This commit is contained in:
Xiaro 2020-11-22 12:59:47 -05:00
parent cef750e173
commit c98437924e
No known key found for this signature in database
GPG Key ID: 996D265D6E155377
1 changed files with 10 additions and 1 deletions

View File

@ -3,11 +3,13 @@ package me.zeroeightsix.kami.module.modules.misc
import com.mojang.authlib.GameProfile
import me.zeroeightsix.kami.command.Command
import me.zeroeightsix.kami.event.events.ConnectionEvent
import me.zeroeightsix.kami.event.events.GuiScreenEvent
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.Settings
import me.zeroeightsix.kami.util.event.listener
import me.zeroeightsix.kami.util.text.MessageSendHelper
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.client.gui.GuiGameOver
import java.util.*
@Module.Info(
@ -25,6 +27,10 @@ object FakePlayer : Module() {
listener<ConnectionEvent.Disconnect> {
disable()
}
listener<GuiScreenEvent.Displayed> {
if (it.screen is GuiGameOver) disable()
}
}
override fun onEnable() {
@ -32,7 +38,10 @@ object FakePlayer : Module() {
disable()
return
}
if (playerName.value == "Player") MessageSendHelper.sendChatMessage("You can use &7'${Command.commandPrefix.value}fp <name>'&r to set a custom name")
if (playerName.value == "Player") {
MessageSendHelper.sendChatMessage("You can use &7'${Command.commandPrefix.value}fp <name>'&r to set a custom name")
}
fakePlayer = EntityOtherPlayerMP(mc.world, GameProfile(UUID.randomUUID(), playerName.value)).apply {
copyLocationAndAnglesFrom(mc.player)
rotationYawHead = mc.player.rotationYawHead