diff --git a/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt index 8d38b1d9..27b61599 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/GeneralExtensions.kt @@ -52,5 +52,4 @@ fun pluginKey(key: String) = NamespacedKey(PluginInstance, key) /** * Shortcut to get a collection of all worlds */ -val worlds: Collection get() = Bukkit.getWorlds() - +val worlds: List get() = Bukkit.getWorlds() diff --git a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/ConsoleSenderExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/ConsoleSenderExtensions.kt index d6a48e8d..8732d561 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/ConsoleSenderExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/ConsoleSenderExtensions.kt @@ -1,6 +1,5 @@ package net.axay.kspigot.extensions.bukkit -import net.axay.kspigot.extensions.console import net.axay.kspigot.main.PluginInstance import net.md_5.bungee.api.ChatColor import org.bukkit.Bukkit @@ -34,7 +33,9 @@ fun CommandSender.printColoredPrefix(text: String, textColor: ChatColor, prefix: sendMessage("${prefixColor}[${prefix}]${textColor} $text") /** - * Dispatches a command sent by Console + * Dispatches the command given by [commandLine]. + * + * @param commandLine the command without a leading / */ -fun dispatchCommand(commandLine: String) = Bukkit.dispatchCommand(console, commandLine) - +fun CommandSender.dispatchCommand(commandLine: String) = + Bukkit.dispatchCommand(this, commandLine) diff --git a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt index bac89dc2..08a1e73b 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt @@ -30,10 +30,9 @@ val Entity.isFeetInWater: Boolean get() = this.location.block.type == Material.W val Entity.isGroundSolid: Boolean get() = this.location.add(0.0, -0.01, 0.0).block.type.isSolid /** - * Checks if the entity stands on a specific material. - * @param material the material you are looking for + * Returns the material that is present under the feet of this entity. */ -fun Entity.isOnMaterial(material: Material): Boolean = location.block.type == material +val Entity.groundMaterial get() = this.location.add(0.0, -0.01, 0.0).block.type /** * Kills the damageable. diff --git a/src/main/kotlin/net/axay/kspigot/extensions/geometry/KSpigotLocations.kt b/src/main/kotlin/net/axay/kspigot/extensions/geometry/KSpigotLocations.kt index 46241393..dd413096 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/geometry/KSpigotLocations.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/geometry/KSpigotLocations.kt @@ -40,5 +40,8 @@ fun SimpleLocation3D.withWorld(world: World) = Location(world, x, y, z).apply { fun SimpleChunkLocation.withWorld(world: World) = world.getChunkAt(x, z) fun Vector.toSimpleLoc() = SimpleLocation3D(x, y, z) fun SimpleLocation3D.toVector() = Vector(x, y, z) -fun Location.printSimple(): String = "[$x, $y, $z]" +/** + * Returns a simple string in the format of `[x, y, z]`. + */ +fun Location.toSimpleString() = "[$x, $y, $z]"