diff --git a/src/main/kotlin/cc/modlabs/kpaper/command/CommandBuilder.kt b/src/main/kotlin/cc/modlabs/kpaper/command/CommandBuilder.kt index c623e66..e5b75d3 100644 --- a/src/main/kotlin/cc/modlabs/kpaper/command/CommandBuilder.kt +++ b/src/main/kotlin/cc/modlabs/kpaper/command/CommandBuilder.kt @@ -2,7 +2,6 @@ import com.mojang.brigadier.tree.LiteralCommandNode import io.papermc.paper.command.brigadier.CommandSourceStack -import io.papermc.paper.command.brigadier.Commands interface CommandBuilder { @@ -13,13 +12,4 @@ interface CommandBuilder { val description: String get() = "" - - fun handleRegister(commands: Commands) { - commands.register( - register(), - description, - aliases - ) - } - } \ No newline at end of file diff --git a/src/main/kotlin/cc/modlabs/kpaper/extensions/BlockExtension.kt b/src/main/kotlin/cc/modlabs/kpaper/extensions/BlockExtension.kt index 801c241..5765712 100644 --- a/src/main/kotlin/cc/modlabs/kpaper/extensions/BlockExtension.kt +++ b/src/main/kotlin/cc/modlabs/kpaper/extensions/BlockExtension.kt @@ -1,9 +1,11 @@ package cc.modlabs.kpaper.extensions +import org.bukkit.Material import org.bukkit.block.Barrel import org.bukkit.block.Block import org.bukkit.block.Chest import org.bukkit.block.Container +import org.bukkit.inventory.ItemStack fun Block.getConnectedStorageContainers() = sequenceOf( getRelative(1, 0, 0), @@ -15,4 +17,8 @@ fun Block.getConnectedStorageContainers() = sequenceOf( ) .filter { it.state is Container } .map { it.state as Container } - .filter { it is Chest || it is Barrel } \ No newline at end of file + .filter { it is Chest || it is Barrel } + +fun Material.asQuantity(amount: Int): ItemStack { + return ItemStack(this, amount) +} \ No newline at end of file diff --git a/src/main/kotlin/cc/modlabs/kpaper/extensions/ExecutionPolicy.kt b/src/main/kotlin/cc/modlabs/kpaper/extensions/ExecutionPolicy.kt index 95a362b..767428b 100644 --- a/src/main/kotlin/cc/modlabs/kpaper/extensions/ExecutionPolicy.kt +++ b/src/main/kotlin/cc/modlabs/kpaper/extensions/ExecutionPolicy.kt @@ -62,4 +62,6 @@ fun timer(period: Long = 1, name: String = "", block: () -> Unit): BukkitTask { return object : BukkitRunnable() { override fun run() = timeLimit(period, name, block) }.runTaskTimer(PluginInstance, 0, period) -} \ No newline at end of file +} + +fun taskRunTimer(period: Long = 1, name: String = "", block: () -> Unit) = timer(period, name, block) \ No newline at end of file