Skip to content

Commit

Permalink
refactor: remove climbable logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Jan 24, 2024
1 parent c5dc501 commit e339ece
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,3 @@ fun BukkitEntity.getMountManager() : MountManagerWithBehavior<*>? {
mountManager as BehaviorManager<*>
)
}

val Player.isInClimbable get() = location.block.type in Tag.CLIMBABLE.values
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,6 @@ internal object MoveListener : Listener {
player.hurtBones(player.fallDistance)
}

private val climbableMap = mutableMapOf<UUID, Float>()
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
fun PlayerMoveEvent.onScaleDownClimbable() {
if (!hasExplicitlyChangedBlock()) return
if (!player.isInClimbable) return

climbableMap.compute(player.uniqueId) { _, v -> (v ?: 0).toFloat() + 1 }
when (player.location.block.getRelative(BlockFace.DOWN).type) {
!in Tag.CLIMBABLE.values -> {
player.hurtBones(climbableMap[player.uniqueId] ?: 0f)
}
else -> {}
}
}

@EventHandler
fun PlayerMoveEvent.playerMove() {
if (player.gameMode != GameMode.SURVIVAL && player.gameMode != GameMode.ADVENTURE) return
Expand Down

0 comments on commit e339ece

Please sign in to comment.