Initial commit
This commit is contained in:
38
src/main/kotlin/com/pobnellion/aoe/ui/PlaceHintValidators.kt
Normal file
38
src/main/kotlin/com/pobnellion/aoe/ui/PlaceHintValidators.kt
Normal file
@ -0,0 +1,38 @@
|
||||
package com.pobnellion.aoe.ui
|
||||
|
||||
import org.bukkit.Location
|
||||
|
||||
class PlaceHintValidators {
|
||||
companion object {
|
||||
|
||||
fun alwaysTrue(location: Location, sizeX: Float, sizeY: Float, sizeZ: Float): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun allAir(location: Location, sizeX: Float, sizeY: Float, sizeZ: Float): Boolean {
|
||||
for (x in 0..<sizeX.toInt())
|
||||
for (y in 0..<sizeY.toInt())
|
||||
for (z in 0..<sizeZ.toInt())
|
||||
if (!location.world.getBlockAt(
|
||||
location.blockX + x,
|
||||
location.blockY + y,
|
||||
location.blockZ + z ).isEmpty)
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fun allReplaceable(location: Location, sizeX: Float, sizeY: Float, sizeZ: Float): Boolean {
|
||||
for (x in 0..<sizeX.toInt())
|
||||
for (y in 0..<sizeY.toInt())
|
||||
for (z in 0..<sizeZ.toInt())
|
||||
if (!location.world.getBlockAt(
|
||||
location.blockX + x,
|
||||
location.blockY + y,
|
||||
location.blockZ + z ).isReplaceable)
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user