From 152bb5096d2419a59806c260f9e2c7c76a8fc7fd Mon Sep 17 00:00:00 2001 From: Kariya Date: Sun, 7 Dec 2025 14:31:48 +0000 Subject: [PATCH] fix: Corrected an issue where elevators would not function if other blocks were present between the elevator blocks. --- .../kaaariyaaa/elevator/listeners/EventListener.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/github/kaaariyaaa/elevator/listeners/EventListener.kt b/src/main/kotlin/com/github/kaaariyaaa/elevator/listeners/EventListener.kt index f5fab6d..f1a7182 100644 --- a/src/main/kotlin/com/github/kaaariyaaa/elevator/listeners/EventListener.kt +++ b/src/main/kotlin/com/github/kaaariyaaa/elevator/listeners/EventListener.kt @@ -29,12 +29,12 @@ class EventListener(private val plugin: App) : Listener { val maxHeight = plugin.config.getInt("maxHeight", 64) var distance = 0 - while (!location.block.type.isSolid && !(location.block.type in oreBlock) && distance < maxHeight) { + while (!(location.block.type in oreBlock) && distance < maxHeight) { location = location.add(0.0, 1.0, 0.0) distance++ } - if (location.block.type.isSolid && location.block.type in oreBlock) { + if (location.block.type in oreBlock) { player.teleport(location.add(0.5, 1.0, 0.5).addRotation(player.location.yaw, player.location.pitch)) } } @@ -47,19 +47,19 @@ class EventListener(private val plugin: App) : Listener { val player = event.player val blockUnder = player.location.subtract(0.0, 1.0, 0.0).block - if (blockUnder.type.isSolid && blockUnder.type in oreBlock) { + if (blockUnder.type in oreBlock) { var location = blockUnder.location location = location.subtract(0.0, 1.0, 0.0) val maxHeight = plugin.config.getInt("maxHeight", 64) var distance = 0 - while (!location.block.type.isSolid && !(location.block.type in oreBlock) && distance < maxHeight) { + while (!(location.block.type in oreBlock) && distance < maxHeight) { location = location.subtract(0.0, 1.0, 0.0) distance++ } - if (location.block.type.isSolid && location.block.type in oreBlock) { + if (location.block.type in oreBlock) { player.teleport(location.add(0.5, 1.0, 0.5).addRotation(player.location.yaw, player.location.pitch)) } }