diff options
Diffstat (limited to 'src/main/kotlin/io/dico/parcels2/util')
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/util/UUIDUtil.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/util/ext/Material.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/util/ext/Math.kt | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/util/UUIDUtil.kt b/src/main/kotlin/io/dico/parcels2/util/UUIDUtil.kt index 268c1b9..1398037 100644 --- a/src/main/kotlin/io/dico/parcels2/util/UUIDUtil.kt +++ b/src/main/kotlin/io/dico/parcels2/util/UUIDUtil.kt @@ -11,10 +11,4 @@ fun getPlayerName(uuid: UUID): String? { return Bukkit.getOfflinePlayer(uuid)?.takeIf { it.isValid }?.name } -fun UUID.toByteArray(): ByteArray = - ByteBuffer.allocate(16).apply { - putLong(mostSignificantBits) - putLong(leastSignificantBits) - }.array() -fun ByteArray.toUUID(): UUID = ByteBuffer.wrap(this).run { UUID(long, long) } diff --git a/src/main/kotlin/io/dico/parcels2/util/ext/Material.kt b/src/main/kotlin/io/dico/parcels2/util/ext/Material.kt index c375cb2..e160e55 100644 --- a/src/main/kotlin/io/dico/parcels2/util/ext/Material.kt +++ b/src/main/kotlin/io/dico/parcels2/util/ext/Material.kt @@ -79,7 +79,7 @@ private fun getMaterialPrefixed(prefix: String, name: String): Material { return Material.getMaterial("${prefix}_$name") ?: throw IllegalArgumentException("Material ${prefix}_$name doesn't exist") } -fun findWoodKindPrefixedMaterials(name: String) = arrayOf( +fun getMaterialsWithWoodTypePrefix(name: String) = arrayOf( getMaterialPrefixed("OAK", name), getMaterialPrefixed("BIRCH", name), getMaterialPrefixed("SPRUCE", name), @@ -88,7 +88,7 @@ fun findWoodKindPrefixedMaterials(name: String) = arrayOf( getMaterialPrefixed("DARK_OAK", name) ) -fun findColorPrefixedMaterials(name: String) = arrayOf( +fun getMaterialsWithWoolColorPrefix(name: String) = arrayOf( getMaterialPrefixed("WHITE", name), getMaterialPrefixed("ORANGE", name), getMaterialPrefixed("MAGENTA", name), diff --git a/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt b/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt index 32540fd..62ee220 100644 --- a/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt +++ b/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt @@ -29,4 +29,7 @@ fun IntRange.clamp(min: Int, max: Int): IntRange { return IntRange(first, max) } return this -}
\ No newline at end of file +} + +// the name coerceAtMost is bad +fun Int.clampMax(max: Int) = coerceAtMost(max)
\ No newline at end of file |