Skip to content

Commit

Permalink
fix: check player-fall-damage before allowing setting bonfire-spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Aug 28, 2024
1 parent e1c44ad commit 5218d9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/main/kotlin/com/mineinabyss/bonfire/BonfireConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ data class BonfireConfig(
val bonfireInteractCooldown: @Serializable(with = DurationSerializer::class) Duration = 2.seconds,
val respawnSetSound: BonfireSound = BonfireSound("block.ladder.step", 1f, 1.5f, SoundCategory.BLOCKS),
val respawnUnsetSound: BonfireSound = BonfireSound("block.ladder.step", 1f, 0.5f, SoundCategory.BLOCKS),
val minFallDist: Int = 3,
val effectRadius: Double = 3.0,
val effectStrength: Float = 10f,
val effectRegenRate: Int = 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.mineinabyss.idofront.messaging.success
import com.mineinabyss.idofront.nms.nbt.editOfflinePDC
import com.mineinabyss.idofront.nms.nbt.getOfflinePDC
import org.bukkit.Bukkit
import org.bukkit.attribute.Attribute
import org.bukkit.entity.ItemDisplay
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
Expand Down Expand Up @@ -95,6 +96,7 @@ class BonfireListener : Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
fun BlockyFurnitureInteractEvent.onBonfireInteract() {
if (!player.isSneaking || hand != EquipmentSlot.HAND || abs(0 - player.velocity.y) < 0.001) return
if (player.fallDistance > (player.getAttribute(Attribute.GENERIC_SAFE_FALL_DISTANCE)?.value ?: 3.0)) return

val gearyPlayer = player.toGeary()
val gearyBonfire = baseEntity.toGearyOrNull() ?: return
Expand Down

0 comments on commit 5218d9f

Please sign in to comment.