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)) } }