diff options
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/util/Utils.kt')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/util/Utils.kt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/util/Utils.kt b/src/main/kotlin/com/dulkirfabric/util/Utils.kt index 18a442e..a0fec78 100644 --- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt @@ -2,6 +2,7 @@ package com.dulkirfabric.util import com.dulkirfabric.events.PlaySoundEvent import com.dulkirfabric.events.SlayerBossEvents +import com.dulkirfabric.events.WorldLoadEvent import com.dulkirfabric.events.chat.ChatEvents import meteordevelopment.orbit.EventHandler import net.minecraft.block.entity.SkullBlockEntity @@ -12,6 +13,9 @@ import net.minecraft.nbt.NbtHelper import net.minecraft.util.math.Vec3d object Utils { + + private var inSlayerBoss = false + fun isInSkyblock(): Boolean { return ScoreBoardUtils.getLines() != null } @@ -47,6 +51,27 @@ object Utils { } } + @EventHandler + fun onSpawn(event: SlayerBossEvents.Spawn) { + inSlayerBoss = true + } + + @EventHandler + fun onSwap(event: WorldLoadEvent) { + if (inSlayerBoss) + SlayerBossEvents.Fail(ScoreBoardUtils.slayerType).post() + } + + @EventHandler + fun onKill(event: SlayerBossEvents.Kill) { + inSlayerBoss = false + } + + @EventHandler + fun onFail(event: SlayerBossEvents.Fail) { + inSlayerBoss = false + } + fun getSkullTexture(itemStack: ItemStack): String? { return itemStack.getSubNbt(SkullBlockEntity.SKULL_OWNER_KEY)?.let(NbtHelper::toGameProfile)?.properties?.get( PlayerSkinProvider.TEXTURES)?.first()?.value |