Skip to content

Commit

Permalink
chore: add alias for timer & fix: remove broken method
Browse files Browse the repository at this point in the history
  • Loading branch information
InvalidJoker committed Jan 8, 2025
1 parent a93e95f commit d2893a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/main/kotlin/cc/modlabs/kpaper/command/CommandBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -13,13 +12,4 @@ interface CommandBuilder {

val description: String
get() = ""

fun handleRegister(commands: Commands) {
commands.register(
register(),
description,
aliases
)
}

}
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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 }
.filter { it is Chest || it is Barrel }

fun Material.asQuantity(amount: Int): ItemStack {
return ItemStack(this, amount)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

fun taskRunTimer(period: Long = 1, name: String = "", block: () -> Unit) = timer(period, name, block)

0 comments on commit d2893a4

Please sign in to comment.