fix: Corrected an issue where elevators would not function if other blocks were present between the elevator blocks.
This commit is contained in:
parent
1266ff75cd
commit
152bb5096d
|
|
@ -29,12 +29,12 @@ class EventListener(private val plugin: App) : Listener {
|
||||||
val maxHeight = plugin.config.getInt("maxHeight", 64)
|
val maxHeight = plugin.config.getInt("maxHeight", 64)
|
||||||
var distance = 0
|
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)
|
location = location.add(0.0, 1.0, 0.0)
|
||||||
distance++
|
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))
|
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 player = event.player
|
||||||
val blockUnder = player.location.subtract(0.0, 1.0, 0.0).block
|
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
|
var location = blockUnder.location
|
||||||
location = location.subtract(0.0, 1.0, 0.0)
|
location = location.subtract(0.0, 1.0, 0.0)
|
||||||
|
|
||||||
val maxHeight = plugin.config.getInt("maxHeight", 64)
|
val maxHeight = plugin.config.getInt("maxHeight", 64)
|
||||||
var distance = 0
|
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)
|
location = location.subtract(0.0, 1.0, 0.0)
|
||||||
distance++
|
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))
|
player.teleport(location.add(0.5, 1.0, 0.5).addRotation(player.location.yaw, player.location.pitch))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user