diff --git a/common/src/main/kotlin/com/undefined/stellar/AbstractStellarCommand.kt b/common/src/main/kotlin/com/undefined/stellar/AbstractStellarCommand.kt index 4530be7..5c90ced 100644 --- a/common/src/main/kotlin/com/undefined/stellar/AbstractStellarCommand.kt +++ b/common/src/main/kotlin/com/undefined/stellar/AbstractStellarCommand.kt @@ -1,5 +1,6 @@ package com.undefined.stellar +import com.undefined.stellar.argument.AbstractStellarArgument import com.undefined.stellar.argument.ArgumentHandler import com.undefined.stellar.data.argument.CommandContext import com.undefined.stellar.data.execution.StellarExecution @@ -15,12 +16,12 @@ import org.jetbrains.annotations.ApiStatus import java.util.* @Suppress("UNCHECKED_CAST") -abstract class AbstractStellarCommand(val name: String, val description: String = "", usage: String = "") : ArgumentHandler() { +abstract class AbstractStellarCommand(val name: String, val description: String = "A custom Stellar command.", usage: String = "", aliases: List = mutableListOf()) : ArgumentHandler() { override val base: AbstractStellarCommand<*> get() = this - @ApiStatus.Internal val aliases: MutableList = mutableListOf() - @ApiStatus.Internal val helpTopic: SortedMap = sortedMapOf() + @ApiStatus.Internal val aliases: MutableList = aliases.toMutableList() + @ApiStatus.Internal val information: SortedMap = sortedMapOf() @ApiStatus.Internal open val failureMessages: MutableList = mutableListOf() @ApiStatus.Internal open val globalFailureMessages: MutableList = mutableListOf() @ApiStatus.Internal open val failureExecutions: MutableList> = mutableListOf() @@ -32,9 +33,11 @@ abstract class AbstractStellarCommand(val name: String, val description: Stri @ApiStatus.Internal open val registerExecutions: MutableList<() -> Unit> = mutableListOf() init { - if (description.isNotEmpty()) helpTopic["Description"] to description - if (usage.isNotEmpty()) helpTopic["Usage"] to usage - if (aliases.isNotEmpty()) helpTopic["Aliases"] = aliases.joinToString(", ") + if (this !is AbstractStellarArgument<*>) { + if (aliases.isNotEmpty()) information["Aliases"] = aliases.joinToString(", ") + if (usage.isNotEmpty()) information["Usage"] = usage + if (description.isNotEmpty()) information["Description"] = description + } } fun setAliases(vararg aliases: String): T { @@ -49,22 +52,22 @@ abstract class AbstractStellarCommand(val name: String, val description: Stri } fun setDescription(description: String): T { - helpTopic["Description"] = description + information["Description"] = description return this as T } fun setUsageText(usage: String): T { - helpTopic["Usage"] = usage + information["Usage"] = usage return this as T } fun setInformation(name: String, text: String): T { - helpTopic[name] = text + information[name] = text return this as T } fun clearInformation(): T { - helpTopic.clear() + information.clear() return this as T } diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/AbstractStellarArgument.kt b/common/src/main/kotlin/com/undefined/stellar/argument/AbstractStellarArgument.kt index e8313b2..7cd20ad 100644 --- a/common/src/main/kotlin/com/undefined/stellar/argument/AbstractStellarArgument.kt +++ b/common/src/main/kotlin/com/undefined/stellar/argument/AbstractStellarArgument.kt @@ -31,12 +31,7 @@ abstract class AbstractStellarArgument(val parent: AbstractStellarCommand<*>, } fun addSuggestions(vararg suggestions: Suggestion): T = addSuggestions(suggestions.toList()) - - fun addSuggestionWithoutTooltip(suggestion: String): T = addSuggestions(listOf(Suggestion(suggestion, ""))) - - fun addSuggestionsWithoutTooltip(suggestions: List): T = addSuggestions(suggestions.map { Suggestion(it, "") }) - - fun addSuggestions(vararg list: String): T = addSuggestions(list.map { Suggestion(it, "") }) + fun addSuggestions(vararg suggestions: String): T = addSuggestions(suggestions.map { Suggestion(it, "") }) fun setSuggestions(vararg suggestions: Suggestion): T { this.suggestions.clear() @@ -58,13 +53,18 @@ abstract class AbstractStellarArgument(val parent: AbstractStellarCommand<*>, return addSuggestions(suggestions.map { Suggestion(it, "") }) } - inline fun addAsyncSuggestion(noinline suggestion: CommandContext.() -> CompletableFuture>): T { + inline fun addFutureSuggestion(noinline suggestion: CommandContext.(input: String) -> CompletableFuture>): T { suggestions.add(StellarSuggestion(C::class, suggestion)) return this as T } - inline fun addSuggestion(noinline suggestion: CommandContext.() -> List): T { - suggestions.add(StellarSuggestion(C::class) { CompletableFuture.completedFuture(suggestion(this)) }) + inline fun addAsyncSuggestion(noinline suggestion: CommandContext.(input: String) -> List): T { + suggestions.add(StellarSuggestion(C::class) { CompletableFuture.supplyAsync { suggestion(this, it) } }) + return this as T + } + + inline fun addSuggestion(noinline suggestion: CommandContext.(input: String) -> List): T { + suggestions.add(StellarSuggestion(C::class) { CompletableFuture.completedFuture(suggestion(this, it)) }) return this as T } diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/ArgumentHandler.kt b/common/src/main/kotlin/com/undefined/stellar/argument/ArgumentHandler.kt index 70fe84b..7edac8e 100644 --- a/common/src/main/kotlin/com/undefined/stellar/argument/ArgumentHandler.kt +++ b/common/src/main/kotlin/com/undefined/stellar/argument/ArgumentHandler.kt @@ -5,6 +5,8 @@ package com.undefined.stellar.argument import com.undefined.stellar.AbstractStellarCommand import com.undefined.stellar.argument.block.BlockDataArgument import com.undefined.stellar.argument.block.BlockPredicateArgument +import com.undefined.stellar.argument.custom.EnumArgument +import com.undefined.stellar.argument.custom.EnumFormatting import com.undefined.stellar.argument.custom.ListArgument import com.undefined.stellar.argument.entity.EntityAnchorArgument import com.undefined.stellar.argument.item.ItemPredicateArgument @@ -163,15 +165,15 @@ open class ArgumentHandler { fun addUUIDListArgument(name: String, list: CommandContext.() -> List): ListArgument = addArgument { ListArgument(UUIDArgument(base, name), list, parse = { it }) } - inline fun > addEnumArgument(name: String): com.undefined.stellar.argument.custom.EnumArgument = - addArgument { com.undefined.stellar.argument.custom.EnumArgument(base, name, T::class) } + inline fun > addEnumArgument(name: String, formatting: EnumFormatting = EnumFormatting.LOWERCASE): EnumArgument = + addArgument { EnumArgument(base, name, T::class, { Suggestion.withText(formatting.action(it!!.name)) }) } inline fun > addEnumArgument( name: String, - noinline converter: (Enum<*>?) -> Suggestion = { Suggestion.withText(it?.name ?: "") }, + noinline converter: (Enum<*>?) -> Suggestion = { Suggestion.withText(it!!.name) }, noinline parse: (Any?) -> Enum? - ): com.undefined.stellar.argument.custom.EnumArgument = addArgument { - com.undefined.stellar.argument.custom.EnumArgument( + ): EnumArgument = addArgument { + EnumArgument( base, name, T::class, diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/custom/EnumArgument.kt b/common/src/main/kotlin/com/undefined/stellar/argument/custom/EnumArgument.kt index a78ef3f..177941a 100644 --- a/common/src/main/kotlin/com/undefined/stellar/argument/custom/EnumArgument.kt +++ b/common/src/main/kotlin/com/undefined/stellar/argument/custom/EnumArgument.kt @@ -12,7 +12,7 @@ class EnumArgument>( parent: AbstractStellarCommand<*>, name: String, val enum: KClass>, - converter: (Enum<*>?) -> Suggestion = { Suggestion.withText(it?.name ?: "") }, + converter: (Enum<*>?) -> Suggestion = { Suggestion.withText(it!!.name) }, parse: (Any?) -> Enum? = { try { valueOf(enum.java, (it as String).uppercase()) as Enum @@ -21,12 +21,16 @@ class EnumArgument>( } } ) : ListArgument?>(StringArgument(parent, name, StringType.WORD), enum.java.enumConstants.toList(), converter, parse) { - fun valueOf(name: String): Enum? = try { valueOf(enum.java, name) as Enum } catch (e: IllegalArgumentException) { null } +} +enum class EnumFormatting(val action: (String) -> String) { + LOWERCASE({ it.lowercase() }), + UPPERCASE({ it.uppercase() }), + CAPITALIZED({ it.lowercase().replaceFirstChar { char -> char.uppercase() } }), } diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/custom/ListArgument.kt b/common/src/main/kotlin/com/undefined/stellar/argument/custom/ListArgument.kt index 5d57746..17aca64 100644 --- a/common/src/main/kotlin/com/undefined/stellar/argument/custom/ListArgument.kt +++ b/common/src/main/kotlin/com/undefined/stellar/argument/custom/ListArgument.kt @@ -25,7 +25,9 @@ open class ListArgument( } override val suggestions: MutableList> - get() = (super.suggestions + StellarSuggestion(CommandSender::class) { CompletableFuture.completedFuture(getSuggestionList(this)) }).toMutableList() + get() = (super.suggestions + StellarSuggestion(CommandSender::class) { input -> + CompletableFuture.completedFuture(getSuggestionList(this).filter { it.text.startsWith(input, true) }) + }).toMutableList() fun getSuggestionList(context: CommandContext): List = list(context).map(converter) diff --git a/common/src/main/kotlin/com/undefined/stellar/data/suggestion/StellarSuggestion.kt b/common/src/main/kotlin/com/undefined/stellar/data/suggestion/StellarSuggestion.kt index ffe1a47..0e04a51 100644 --- a/common/src/main/kotlin/com/undefined/stellar/data/suggestion/StellarSuggestion.kt +++ b/common/src/main/kotlin/com/undefined/stellar/data/suggestion/StellarSuggestion.kt @@ -7,9 +7,7 @@ import kotlin.reflect.KClass import kotlin.reflect.safeCast @Suppress("UNCHECKED_CAST") -data class StellarSuggestion(private val clazz: KClass, private val suggestion: CommandContext.() -> CompletableFuture>) { - fun get(context: CommandContext): CompletableFuture> { - if (clazz.safeCast(context.sender) == null) return CompletableFuture.completedFuture(listOf()) - return suggestion(context as CommandContext) - } +data class StellarSuggestion(private val clazz: KClass, private val suggestion: CommandContext.(input: String) -> CompletableFuture>) { + fun get(context: CommandContext, input: String = ""): CompletableFuture> = // TODO remove default value + clazz.safeCast(context.sender)?.let { suggestion(context as CommandContext, input) } ?: CompletableFuture.completedFuture(listOf()) } \ No newline at end of file diff --git a/paper/api/src/main/kotlin/com/undefined/stellar/StellarCommand.kt b/paper/api/src/main/kotlin/com/undefined/stellar/StellarCommand.kt index f5e66a6..e24cccb 100644 --- a/paper/api/src/main/kotlin/com/undefined/stellar/StellarCommand.kt +++ b/paper/api/src/main/kotlin/com/undefined/stellar/StellarCommand.kt @@ -10,15 +10,13 @@ import org.bukkit.command.CommandSender import org.bukkit.plugin.java.JavaPlugin import org.jetbrains.annotations.ApiStatus -class StellarCommand(name: String, permissions: List = listOf(), aliases: List = listOf()) : AbstractStellarCommand(name) { +class StellarCommand(name: String, permissions: List = listOf(), aliases: List = listOf()) : AbstractStellarCommand(name, aliases = aliases) { constructor(name: String, vararg aliases: String) : this(name, aliases = aliases.toList()) - constructor(name: String, permission: String, vararg aliases: String) : this(name, listOf(permission), aliases.toList()) constructor(name: String, permission: String, aliases: List) : this(name, listOf(permission), aliases) init { this.permissionRequirements.addAll(permissions.map { PermissionStellarRequirement(1, it) }) - this.aliases.addAll(aliases) } private var registered = false diff --git a/paper/api/src/main/kotlin/com/undefined/stellar/util/Builders.kt b/paper/api/src/main/kotlin/com/undefined/stellar/util/Builders.kt index d2b5ada..1bf9d71 100644 --- a/paper/api/src/main/kotlin/com/undefined/stellar/util/Builders.kt +++ b/paper/api/src/main/kotlin/com/undefined/stellar/util/Builders.kt @@ -13,4 +13,16 @@ fun command(name: String, description: String, builder: StellarCommand.() -> Uni fun command(name: String, description: String, permissions: List, builder: StellarCommand.() -> Unit): StellarCommand = command(name, description, permissions, listOf(), builder) fun command(name: String, permissions: List, builder: StellarCommand.() -> Unit): StellarCommand = command(name, "", permissions, listOf(), builder) fun command(name: String, permissions: List, aliases: List, builder: StellarCommand.() -> Unit): StellarCommand = command(name, "", permissions, aliases, builder) -fun command(name: String, builder: StellarCommand.() -> Unit): StellarCommand = command(name, "", builder) \ No newline at end of file +fun command(name: String, builder: StellarCommand.() -> Unit): StellarCommand = command(name, "", builder) + +fun command(name: String, description: String, permissions: List, aliases: List): StellarCommand { + val command = StellarCommand(name, permissions, aliases) + command.setDescription(description) + return command +} + +fun command(name: String, description: String): StellarCommand = command(name, description, listOf(), listOf()) +fun command(name: String, description: String, permissions: List): StellarCommand = command(name, description, permissions, listOf()) +fun command(name: String, permissions: List): StellarCommand = command(name, "", permissions, listOf()) +fun command(name: String, permissions: List, aliases: List): StellarCommand = command(name, "", permissions, aliases) +fun command(name: String): StellarCommand = command(name, "") \ No newline at end of file diff --git a/paper/common/src/main/kotlin/com/undefined/stellar/arguments/custom/CustomArgument.kt b/paper/common/src/main/kotlin/com/undefined/stellar/arguments/custom/CustomArgument.kt deleted file mode 100644 index aec70e8..0000000 --- a/paper/common/src/main/kotlin/com/undefined/stellar/arguments/custom/CustomArgument.kt +++ /dev/null @@ -1,48 +0,0 @@ -package com.undefined.stellar.arguments.custom - -import com.undefined.stellar.AbstractStellarCommand -import com.undefined.stellar.argument.AbstractStellarArgument -import com.undefined.stellar.data.argument.CommandContext -import com.undefined.stellar.data.execution.StellarExecution -import com.undefined.stellar.data.execution.StellarRunnable -import com.undefined.stellar.data.requirement.StellarRequirement -import com.undefined.stellar.data.suggestion.StellarSuggestion -import com.undefined.stellar.data.suggestion.Suggestion -import org.bukkit.command.CommandSender -import java.util.concurrent.CompletableFuture - -abstract class CustomArgument( - parent: AbstractStellarCommand<*>, - name: String -) : AbstractStellarArgument(parent, name) { - - override val arguments: MutableList> - get() = (super.arguments + getArgumentsList()).toMutableList() - override val failureExecutions: MutableList> - get() = (super.failureExecutions + StellarExecution(CommandSender::class) { - failureExecution(this, arguments.values.last()) - }).toMutableList() - override val requirements: MutableList> - get() = (super.requirements + StellarRequirement(CommandSender::class) { requirement() }).toMutableList() - override val executions: MutableList> - get() = (super.executions + StellarExecution(CommandSender::class) { - execution(this, this.arguments.values.last()) - }).toMutableList() - override val runnables: MutableList> - get() = (super.runnables + StellarRunnable(CommandSender::class) { - runnable(this, this[name]) - }).toMutableList() - override val suggestions: MutableList> - get() = (super.suggestions + StellarSuggestion(CommandSender::class) { - listSuggestions(this) - }).toMutableList() - - open fun getArgumentsList(): List> = listOf() - abstract fun parse(context: CommandContext): T - open fun execution(info: CommandContext, value: T) {} - open fun runnable(info: CommandContext, value: T): Boolean = true - open fun failureExecution(info: CommandContext, value: T) {} - open fun requirement(): Boolean = true - abstract fun listSuggestions(context: CommandContext): CompletableFuture> - -} \ No newline at end of file diff --git a/paper/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt b/paper/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt index 5be5e64..9e6c78a 100644 --- a/paper/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt +++ b/paper/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt @@ -15,6 +15,7 @@ import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +28,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -62,7 +63,7 @@ object BrigadierCommandHelper { val stellarContext = CommandContextAdapter.getStellarCommandContext(context) val completions: CompletableFuture> = CompletableFuture.supplyAsync { val suggestions: MutableList = mutableListOf() - for (suggestion in command.suggestions) suggestions.addAll(suggestion.get(stellarContext).get()) + for (suggestion in command.suggestions) suggestions.addAll(suggestion.get(stellarContext, builder.remaining).get()) suggestions } return CommandAdapter.getMojangSuggestions(builder, completions) diff --git a/server/src/main/kotlin/com/undefined/stellar/Main.kt b/server/src/main/kotlin/com/undefined/stellar/Main.kt index bed3a3a..f82cdd2 100644 --- a/server/src/main/kotlin/com/undefined/stellar/Main.kt +++ b/server/src/main/kotlin/com/undefined/stellar/Main.kt @@ -1,26 +1,23 @@ package com.undefined.stellar +import com.undefined.stellar.argument.custom.EnumFormatting import com.undefined.stellar.data.suggestion.Suggestion -import org.bukkit.Bukkit import org.bukkit.World.Environment import org.bukkit.entity.Player -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener -import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.plugin.java.JavaPlugin import java.util.concurrent.CompletableFuture class Main : JavaPlugin() { override fun onEnable() { - StellarCommand("test") - .addEnumArgument("env") + StellarCommand("test", "t") + .addEnumArgument("env", EnumFormatting.LOWERCASE) .addExecution { val env = getArgument("env") sender.sendMessage(env.name) } .addStringArgument("test") - .addAsyncSuggestion { + .addFutureSuggestion { CompletableFuture.supplyAsync { return@supplyAsync listOf(Suggestion.withText("test")) } diff --git a/spigot/v1_13/src/main/kotlin/com/undefined/stellar/v1_13/BrigadierCommandHelper.kt b/spigot/v1_13/src/main/kotlin/com/undefined/stellar/v1_13/BrigadierCommandHelper.kt index db45919..2dbd553 100644 --- a/spigot/v1_13/src/main/kotlin/com/undefined/stellar/v1_13/BrigadierCommandHelper.kt +++ b/spigot/v1_13/src/main/kotlin/com/undefined/stellar/v1_13/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_13_R1.CommandListenerWrapper import net.minecraft.server.v1_13_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_13_1/src/main/kotlin/com/undefined/stellar/v1_13_1/BrigadierCommandHelper.kt b/spigot/v1_13_1/src/main/kotlin/com/undefined/stellar/v1_13_1/BrigadierCommandHelper.kt index 66a41b4..f7cfada 100644 --- a/spigot/v1_13_1/src/main/kotlin/com/undefined/stellar/v1_13_1/BrigadierCommandHelper.kt +++ b/spigot/v1_13_1/src/main/kotlin/com/undefined/stellar/v1_13_1/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_13_R2.CommandListenerWrapper import net.minecraft.server.v1_13_R2.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_13_2/src/main/kotlin/com/undefined/stellar/v1_13_2/BrigadierCommandHelper.kt b/spigot/v1_13_2/src/main/kotlin/com/undefined/stellar/v1_13_2/BrigadierCommandHelper.kt index 390627b..9b437f8 100644 --- a/spigot/v1_13_2/src/main/kotlin/com/undefined/stellar/v1_13_2/BrigadierCommandHelper.kt +++ b/spigot/v1_13_2/src/main/kotlin/com/undefined/stellar/v1_13_2/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_13_R2.CommandListenerWrapper import net.minecraft.server.v1_13_R2.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_14_1/src/main/kotlin/com/undefined/stellar/v1_14_1/BrigadierCommandHelper.kt b/spigot/v1_14_1/src/main/kotlin/com/undefined/stellar/v1_14_1/BrigadierCommandHelper.kt index a74dbb0..c5b1aee 100644 --- a/spigot/v1_14_1/src/main/kotlin/com/undefined/stellar/v1_14_1/BrigadierCommandHelper.kt +++ b/spigot/v1_14_1/src/main/kotlin/com/undefined/stellar/v1_14_1/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_14_R1.CommandListenerWrapper import net.minecraft.server.v1_14_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_14_2/src/main/kotlin/com/undefined/stellar/v1_14_2/BrigadierCommandHelper.kt b/spigot/v1_14_2/src/main/kotlin/com/undefined/stellar/v1_14_2/BrigadierCommandHelper.kt index 8d629c0..02cfcb1 100644 --- a/spigot/v1_14_2/src/main/kotlin/com/undefined/stellar/v1_14_2/BrigadierCommandHelper.kt +++ b/spigot/v1_14_2/src/main/kotlin/com/undefined/stellar/v1_14_2/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_14_R1.CommandListenerWrapper import net.minecraft.server.v1_14_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_14_3/src/main/kotlin/com/undefined/stellar/v1_14_3/BrigadierCommandHelper.kt b/spigot/v1_14_3/src/main/kotlin/com/undefined/stellar/v1_14_3/BrigadierCommandHelper.kt index fbddd53..2c562b2 100644 --- a/spigot/v1_14_3/src/main/kotlin/com/undefined/stellar/v1_14_3/BrigadierCommandHelper.kt +++ b/spigot/v1_14_3/src/main/kotlin/com/undefined/stellar/v1_14_3/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_14_R1.CommandListenerWrapper import net.minecraft.server.v1_14_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_14_4/src/main/kotlin/com/undefined/stellar/v1_14_4/BrigadierCommandHelper.kt b/spigot/v1_14_4/src/main/kotlin/com/undefined/stellar/v1_14_4/BrigadierCommandHelper.kt index 3196e72..be612d3 100644 --- a/spigot/v1_14_4/src/main/kotlin/com/undefined/stellar/v1_14_4/BrigadierCommandHelper.kt +++ b/spigot/v1_14_4/src/main/kotlin/com/undefined/stellar/v1_14_4/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_14_R1.CommandListenerWrapper import net.minecraft.server.v1_14_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_15/src/main/kotlin/com/undefined/stellar/v1_15/BrigadierCommandHelper.kt b/spigot/v1_15/src/main/kotlin/com/undefined/stellar/v1_15/BrigadierCommandHelper.kt index 80cf96d..4b5f6da 100644 --- a/spigot/v1_15/src/main/kotlin/com/undefined/stellar/v1_15/BrigadierCommandHelper.kt +++ b/spigot/v1_15/src/main/kotlin/com/undefined/stellar/v1_15/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_15_R1.CommandListenerWrapper import net.minecraft.server.v1_15_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_15_1/src/main/kotlin/com/undefined/stellar/v1_15_1/BrigadierCommandHelper.kt b/spigot/v1_15_1/src/main/kotlin/com/undefined/stellar/v1_15_1/BrigadierCommandHelper.kt index 657956b..21670af 100644 --- a/spigot/v1_15_1/src/main/kotlin/com/undefined/stellar/v1_15_1/BrigadierCommandHelper.kt +++ b/spigot/v1_15_1/src/main/kotlin/com/undefined/stellar/v1_15_1/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_15_R1.CommandListenerWrapper import net.minecraft.server.v1_15_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_15_2/src/main/kotlin/com/undefined/stellar/v1_15_2/BrigadierCommandHelper.kt b/spigot/v1_15_2/src/main/kotlin/com/undefined/stellar/v1_15_2/BrigadierCommandHelper.kt index cd04db1..1868f85 100644 --- a/spigot/v1_15_2/src/main/kotlin/com/undefined/stellar/v1_15_2/BrigadierCommandHelper.kt +++ b/spigot/v1_15_2/src/main/kotlin/com/undefined/stellar/v1_15_2/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_15_R1.CommandListenerWrapper import net.minecraft.server.v1_15_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_16_1/src/main/kotlin/com/undefined/stellar/v1_16_1/BrigadierCommandHelper.kt b/spigot/v1_16_1/src/main/kotlin/com/undefined/stellar/v1_16_1/BrigadierCommandHelper.kt index 80fb7b2..7e60179 100644 --- a/spigot/v1_16_1/src/main/kotlin/com/undefined/stellar/v1_16_1/BrigadierCommandHelper.kt +++ b/spigot/v1_16_1/src/main/kotlin/com/undefined/stellar/v1_16_1/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_16_R1.CommandListenerWrapper import net.minecraft.server.v1_16_R1.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_16_2/src/main/kotlin/com/undefined/stellar/v1_16_2/BrigadierCommandHelper.kt b/spigot/v1_16_2/src/main/kotlin/com/undefined/stellar/v1_16_2/BrigadierCommandHelper.kt index c42ea04..3e9a5a2 100644 --- a/spigot/v1_16_2/src/main/kotlin/com/undefined/stellar/v1_16_2/BrigadierCommandHelper.kt +++ b/spigot/v1_16_2/src/main/kotlin/com/undefined/stellar/v1_16_2/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_16_R2.CommandListenerWrapper import net.minecraft.server.v1_16_R2.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_16_3/src/main/kotlin/com/undefined/stellar/v1_16_3/BrigadierCommandHelper.kt b/spigot/v1_16_3/src/main/kotlin/com/undefined/stellar/v1_16_3/BrigadierCommandHelper.kt index 49367b2..240fddc 100644 --- a/spigot/v1_16_3/src/main/kotlin/com/undefined/stellar/v1_16_3/BrigadierCommandHelper.kt +++ b/spigot/v1_16_3/src/main/kotlin/com/undefined/stellar/v1_16_3/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_16_R2.CommandListenerWrapper import net.minecraft.server.v1_16_R2.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_16_4/src/main/kotlin/com/undefined/stellar/v1_16_4/BrigadierCommandHelper.kt b/spigot/v1_16_4/src/main/kotlin/com/undefined/stellar/v1_16_4/BrigadierCommandHelper.kt index 588a288..46eb3f7 100644 --- a/spigot/v1_16_4/src/main/kotlin/com/undefined/stellar/v1_16_4/BrigadierCommandHelper.kt +++ b/spigot/v1_16_4/src/main/kotlin/com/undefined/stellar/v1_16_4/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_16_R3.CommandListenerWrapper import net.minecraft.server.v1_16_R3.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_16_5/src/main/kotlin/com/undefined/stellar/v1_16_5/BrigadierCommandHelper.kt b/spigot/v1_16_5/src/main/kotlin/com/undefined/stellar/v1_16_5/BrigadierCommandHelper.kt index 9df74c0..59067aa 100644 --- a/spigot/v1_16_5/src/main/kotlin/com/undefined/stellar/v1_16_5/BrigadierCommandHelper.kt +++ b/spigot/v1_16_5/src/main/kotlin/com/undefined/stellar/v1_16_5/BrigadierCommandHelper.kt @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.server.v1_16_R3.CommandListenerWrapper import net.minecraft.server.v1_16_R3.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -31,7 +30,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().serverCommandListener val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -92,9 +91,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/ArgumentHelper.kt b/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/ArgumentHelper.kt index 198bfe4..853cde3 100644 --- a/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/ArgumentHelper.kt +++ b/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/ArgumentHelper.kt @@ -37,7 +37,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.SharedSuggestionProvider import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/BrigadierCommandHelper.kt b/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/BrigadierCommandHelper.kt index e5233c9..31b1b65 100644 --- a/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/BrigadierCommandHelper.kt +++ b/spigot/v1_17/src/main/kotlin/com/undefined/stellar/v1_17/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/ArgumentHelper.kt b/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/ArgumentHelper.kt index d9cdd67..52a1374 100644 --- a/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/ArgumentHelper.kt +++ b/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/ArgumentHelper.kt @@ -37,7 +37,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.SharedSuggestionProvider import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* @@ -96,10 +99,10 @@ object ArgumentHelper { is VillagerProfessionArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.VILLAGER_PROFESSION.keySet(), builder) } - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> SuggestionProvider { _, builder -> + is VillagerTypeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.VILLAGER_TYPE.keySet(), builder) } - is com.undefined.stellar.argument.registry.AttributeArgument -> SuggestionProvider { _, builder -> + is AttributeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.ATTRIBUTE.keySet(), builder) } is FluidArgument -> SuggestionProvider { _, builder -> @@ -108,13 +111,13 @@ object ArgumentHelper { is SoundArgument -> SuggestionProvider { context, builder -> SuggestionProviders.AVAILABLE_SOUNDS.getSuggestions(context, builder) } - is com.undefined.stellar.argument.registry.BiomeArgument -> SuggestionProvider { context, builder -> + is BiomeArgument -> SuggestionProvider { context, builder -> SuggestionProviders.AVAILABLE_BIOMES.getSuggestions(context, builder) } is EntityTypeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.ENTITY_TYPE.keySet(), builder) } - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> SuggestionProvider { _, builder -> + is MemoryKeyArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.MEMORY_MODULE_TYPE.keySet(), builder) } else -> null @@ -174,31 +177,31 @@ object ArgumentHelper { is LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.uuid() is GameEventArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.StructureTypeArgument -> throwArgumentVersionException(argument) + is StructureTypeArgument -> throwArgumentVersionException(argument) is PotionEffectTypeArgument -> throwArgumentVersionException(argument) is BlockTypeArgument -> throwArgumentVersionException(argument) is ItemTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> throwArgumentVersionException(argument) + is FrogVariantArgument -> throwArgumentVersionException(argument) is VillagerProfessionArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> ResourceLocationArgument.id() + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.AttributeArgument -> ResourceLocationArgument.id() + is AttributeArgument -> ResourceLocationArgument.id() is FluidArgument -> ResourceLocationArgument.id() is SoundArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.BiomeArgument -> ResourceLocationArgument.id() + is BiomeArgument -> ResourceLocationArgument.id() is StructureArgument -> throwArgumentVersionException(argument) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> throwArgumentVersionException(argument) + is ArtArgument -> throwArgumentVersionException(argument) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> ResourceLocationArgument.id() is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> ResourceLocationArgument.id() + is MemoryKeyArgument -> ResourceLocationArgument.id() else -> throw UnsupportedArgumentException(argument) } @@ -270,31 +273,31 @@ object ArgumentHelper { is LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.getUuid(context, argument.name) is GameEventArgument -> org.bukkit.Registry.GAME_EVENT.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> throwArgumentVersionException(argument) + is StructureTypeArgument -> throwArgumentVersionException(argument) is PotionEffectTypeArgument -> throwArgumentVersionException(argument) is BlockTypeArgument -> throwArgumentVersionException(argument) is ItemTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> throwArgumentVersionException(argument) + is FrogVariantArgument -> throwArgumentVersionException(argument) is VillagerProfessionArgument -> org.bukkit.Registry.VILLAGER_PROFESSION.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name)) + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> getInventoryType(Registry.MENU.getOrThrow(ResourceKey.create(Registry.MENU_REGISTRY, ResourceLocationArgument.getId(context, argument.name)))) - is com.undefined.stellar.argument.registry.AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name)) + is AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name)) is FluidArgument -> org.bukkit.Registry.FLUID.get(getId(context, argument.name)) is SoundArgument -> org.bukkit.Registry.SOUNDS.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name)) + is BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name)) is StructureArgument -> throwArgumentVersionException(argument) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> throwArgumentVersionException(argument) + is ArtArgument -> throwArgumentVersionException(argument) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> org.bukkit.Registry.ENTITY_TYPE.get(getId(context, argument.name)) is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name)) + is MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name)) else -> throw UnsupportedArgumentException(argument) } } diff --git a/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/BrigadierCommandHelper.kt b/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/BrigadierCommandHelper.kt index 68f49e5..2305be8 100644 --- a/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/BrigadierCommandHelper.kt +++ b/spigot/v1_17_1/src/main/kotlin/com/undefined/stellar/BrigadierCommandHelper.kt @@ -11,9 +11,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -26,7 +26,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -87,9 +87,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/ArgumentHelper.kt b/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/ArgumentHelper.kt index 22d287b..1cce98d 100644 --- a/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/ArgumentHelper.kt +++ b/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/ArgumentHelper.kt @@ -1,5 +1,3 @@ -@file:Suppress("DEPRECATION") - package com.undefined.stellar.v1_18_1 import com.mojang.brigadier.arguments.* @@ -37,7 +35,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.SharedSuggestionProvider import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* @@ -69,7 +70,7 @@ import org.bukkit.scoreboard.DisplaySlot import java.util.* import java.util.function.Predicate -@Suppress("UNCHECKED_CAST") +@Suppress("UNCHECKED_CAST", "DEPRECATION") object ArgumentHelper { fun getLiteralArguments(argument: AbstractStellarArgument<*>): List> { @@ -93,10 +94,10 @@ object ArgumentHelper { is VillagerProfessionArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.VILLAGER_PROFESSION.keySet(), builder) } - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> SuggestionProvider { _, builder -> + is VillagerTypeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.VILLAGER_TYPE.keySet(), builder) } - is com.undefined.stellar.argument.registry.AttributeArgument -> SuggestionProvider { _, builder -> + is AttributeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.ATTRIBUTE.keySet(), builder) } is FluidArgument -> SuggestionProvider { _, builder -> @@ -105,13 +106,13 @@ object ArgumentHelper { is SoundArgument -> SuggestionProvider { context, builder -> SuggestionProviders.AVAILABLE_SOUNDS.getSuggestions(context, builder) } - is com.undefined.stellar.argument.registry.BiomeArgument -> SuggestionProvider { context, builder -> + is BiomeArgument -> SuggestionProvider { context, builder -> SuggestionProviders.AVAILABLE_BIOMES.getSuggestions(context, builder) } is EntityTypeArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.ENTITY_TYPE.keySet(), builder) } - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> SuggestionProvider { _, builder -> + is MemoryKeyArgument -> SuggestionProvider { _, builder -> SharedSuggestionProvider.suggestResource(Registry.MEMORY_MODULE_TYPE.keySet(), builder) } else -> null @@ -124,8 +125,8 @@ object ArgumentHelper { is StringArgument -> brigadier(argument.type) is PhraseArgument -> brigadier(StringType.PHRASE) is IntegerArgument -> IntegerArgumentType.integer(argument.min, argument.max) - is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.longArg(argument.min, argument.max) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) + is LongArgument -> LongArgumentType.longArg(argument.min, argument.max) + is FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) is DoubleArgument -> DoubleArgumentType.doubleArg(argument.min, argument.max) is BooleanArgument -> BoolArgumentType.bool() is com.undefined.stellar.argument.entity.EntityArgument -> brigadier(argument.type) @@ -171,31 +172,31 @@ object ArgumentHelper { is LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.uuid() is GameEventArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.StructureTypeArgument -> throwArgumentVersionException(argument) + is StructureTypeArgument -> throwArgumentVersionException(argument) is PotionEffectTypeArgument -> throwArgumentVersionException(argument) is BlockTypeArgument -> throwArgumentVersionException(argument) is ItemTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> throwArgumentVersionException(argument) + is FrogVariantArgument -> throwArgumentVersionException(argument) is VillagerProfessionArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> ResourceLocationArgument.id() + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.AttributeArgument -> ResourceLocationArgument.id() + is AttributeArgument -> ResourceLocationArgument.id() is FluidArgument -> ResourceLocationArgument.id() is SoundArgument -> ResourceLocationArgument.id() - is com.undefined.stellar.argument.registry.BiomeArgument -> ResourceLocationArgument.id() + is BiomeArgument -> ResourceLocationArgument.id() is StructureArgument -> throwArgumentVersionException(argument) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> throwArgumentVersionException(argument) + is ArtArgument -> throwArgumentVersionException(argument) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> ResourceLocationArgument.id() is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> ResourceLocationArgument.id() + is MemoryKeyArgument -> ResourceLocationArgument.id() else -> throw UnsupportedArgumentException(argument) } @@ -205,8 +206,8 @@ object ArgumentHelper { is CustomArgument<*> -> argument.parse(CommandContextAdapter.getStellarCommandContext(context)) is StringArgument -> StringArgumentType.getString(context, argument.name) is IntegerArgument -> IntegerArgumentType.getInteger(context, argument.name) - is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.getLong(context, argument.name) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.getFloat(context, argument.name) + is LongArgument -> LongArgumentType.getLong(context, argument.name) + is FloatArgument -> FloatArgumentType.getFloat(context, argument.name) is DoubleArgument -> DoubleArgumentType.getDouble(context, argument.name) is BooleanArgument -> BoolArgumentType.getBool(context, argument.name) is ListArgument<*> -> argument.parse(getParsedArgument(context, argument)) @@ -267,28 +268,28 @@ object ArgumentHelper { is LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.getUuid(context, argument.name) is GameEventArgument -> org.bukkit.Registry.GAME_EVENT.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> throwArgumentVersionException(argument) + is StructureTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> throwArgumentVersionException(argument) + is FrogVariantArgument -> throwArgumentVersionException(argument) is VillagerProfessionArgument -> org.bukkit.Registry.VILLAGER_PROFESSION.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name)) + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> getInventoryType(Registry.MENU.getOrThrow(ResourceKey.create(Registry.MENU_REGISTRY, ResourceLocationArgument.getId(context, argument.name)))) - is com.undefined.stellar.argument.registry.AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name)) + is AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name)) is FluidArgument -> org.bukkit.Registry.FLUID.get(getId(context, argument.name)) is SoundArgument -> org.bukkit.Registry.SOUNDS.get(getId(context, argument.name)) - is com.undefined.stellar.argument.registry.BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name)) + is BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name)) is StructureArgument -> throwArgumentVersionException(argument) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> throwArgumentVersionException(argument) + is ArtArgument -> throwArgumentVersionException(argument) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> org.bukkit.Registry.ENTITY_TYPE.get(getId(context, argument.name)) is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name)) + is MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name)) else -> throw UnsupportedArgumentException(argument) } } @@ -345,11 +346,11 @@ object ArgumentHelper { StringType.PHRASE -> StringArgumentType.greedyString() } - private fun brigadier(type: com.undefined.stellar.argument.entity.EntityDisplayType): EntityArgument = when (type) { - com.undefined.stellar.argument.entity.EntityDisplayType.ENTITY -> EntityArgument.entity() - com.undefined.stellar.argument.entity.EntityDisplayType.ENTITIES -> EntityArgument.entities() - com.undefined.stellar.argument.entity.EntityDisplayType.PLAYER -> EntityArgument.player() - com.undefined.stellar.argument.entity.EntityDisplayType.PLAYERS -> EntityArgument.players() + private fun brigadier(type: EntityDisplayType): EntityArgument = when (type) { + EntityDisplayType.ENTITY -> EntityArgument.entity() + EntityDisplayType.ENTITIES -> EntityArgument.entities() + EntityDisplayType.PLAYER -> EntityArgument.player() + EntityDisplayType.PLAYERS -> EntityArgument.players() } private fun getBukkitAxis(argument: EnumSet): EnumSet = @@ -412,7 +413,7 @@ object ArgumentHelper { private fun getLocation(context: CommandContext, command: LocationArgument): Location { val world = context.source.level.world return when (command.type) { - LocationType.LOCATION_3D -> context.getArgument(command.name, Coordinates::class.java).getBlockPos(context.source).toLocation(world); + LocationType.LOCATION_3D -> context.getArgument(command.name, Coordinates::class.java).getBlockPos(context.source).toLocation(world) LocationType.LOCATION_2D -> ColumnPosArgument.getColumnPos(context, command.name).toLocation(world) LocationType.PRECISE_LOCATION_3D -> Vec3Argument.getVec3(context, command.name).toLocation(world) LocationType.PRECISE_LOCATION_2D -> Vec2Argument.getVec2(context, command.name).toLocation(world) diff --git a/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/BrigadierCommandHelper.kt b/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/BrigadierCommandHelper.kt index ee43a0d..f0c3605 100644 --- a/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/BrigadierCommandHelper.kt +++ b/spigot/v1_18_1/src/main/kotlin/com/undefined/stellar/v1_18_1/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/ArgumentHelper.kt b/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/ArgumentHelper.kt index a00f731..46e3584 100644 --- a/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/ArgumentHelper.kt +++ b/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/ArgumentHelper.kt @@ -33,7 +33,10 @@ import com.undefined.stellar.util.NMSVersion import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/BrigadierCommandHelper.kt b/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/BrigadierCommandHelper.kt index 7ec3303..aec999f 100644 --- a/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/BrigadierCommandHelper.kt +++ b/spigot/v1_18_2/src/main/kotlin/com/undefined/stellar/v1_18_2/BrigadierCommandHelper.kt @@ -12,7 +12,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture @Suppress("DEPRECATION") @@ -28,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -89,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt b/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt index f100846..d0c2504 100644 --- a/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt +++ b/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt @@ -34,7 +34,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/BrigadierCommandHelper.kt b/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/BrigadierCommandHelper.kt index ec10e25..95b3154 100644 --- a/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/BrigadierCommandHelper.kt +++ b/spigot/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt b/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt index 0c240a8..0a2d132 100644 --- a/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt +++ b/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* @@ -96,8 +99,8 @@ object ArgumentHelper { is StringArgument -> brigadier(argument.type) is PhraseArgument -> brigadier(StringType.PHRASE) is IntegerArgument -> IntegerArgumentType.integer(argument.min, argument.max) - is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.longArg(argument.min, argument.max) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) + is LongArgument -> LongArgumentType.longArg(argument.min, argument.max) + is FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) is DoubleArgument -> DoubleArgumentType.doubleArg(argument.min, argument.max) is BooleanArgument -> BoolArgumentType.bool() is com.undefined.stellar.argument.entity.EntityArgument -> brigadier(argument.type) @@ -145,31 +148,31 @@ object ArgumentHelper { is com.undefined.stellar.argument.structure.LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.uuid() is GameEventArgument -> ResourceKeyArgument.key(Registries.GAME_EVENT) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> ResourceKeyArgument.key(Registries.STRUCTURE_TYPE) + is StructureTypeArgument -> ResourceKeyArgument.key(Registries.STRUCTURE_TYPE) is PotionEffectTypeArgument -> throwArgumentVersionException(argument) is BlockTypeArgument -> throwArgumentVersionException(argument) is ItemTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> ResourceKeyArgument.key(Registries.FROG_VARIANT) + is FrogVariantArgument -> ResourceKeyArgument.key(Registries.FROG_VARIANT) is VillagerProfessionArgument -> ResourceKeyArgument.key(Registries.VILLAGER_PROFESSION) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> ResourceKeyArgument.key(Registries.VILLAGER_TYPE) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> ResourceKeyArgument.key(Registries.VILLAGER_TYPE) + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.AttributeArgument -> ResourceKeyArgument.key(Registries.ATTRIBUTE) + is AttributeArgument -> ResourceKeyArgument.key(Registries.ATTRIBUTE) is FluidArgument -> ResourceKeyArgument.key(Registries.FLUID) is SoundArgument -> ResourceKeyArgument.key(Registries.SOUND_EVENT) - is com.undefined.stellar.argument.registry.BiomeArgument -> ResourceKeyArgument.key(Registries.BIOME) + is BiomeArgument -> ResourceKeyArgument.key(Registries.BIOME) is StructureArgument -> ResourceKeyArgument.key(Registries.STRUCTURE) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> ResourceKeyArgument.key(Registries.PAINTING_VARIANT) + is ArtArgument -> ResourceKeyArgument.key(Registries.PAINTING_VARIANT) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> ResourceKeyArgument.key(Registries.ENTITY_TYPE) is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> ResourceKeyArgument.key(Registries.MEMORY_MODULE_TYPE) + is MemoryKeyArgument -> ResourceKeyArgument.key(Registries.MEMORY_MODULE_TYPE) else -> throw UnsupportedArgumentException(argument) } @@ -179,8 +182,8 @@ object ArgumentHelper { is CustomArgument<*> -> argument.parse(CommandContextAdapter.getStellarCommandContext(context)) is StringArgument -> StringArgumentType.getString(context, argument.name) is IntegerArgument -> IntegerArgumentType.getInteger(context, argument.name) - is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.getLong(context, argument.name) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.getFloat(context, argument.name) + is LongArgument -> LongArgumentType.getLong(context, argument.name) + is FloatArgument -> FloatArgumentType.getFloat(context, argument.name) is DoubleArgument -> DoubleArgumentType.getDouble(context, argument.name) is BooleanArgument -> BoolArgumentType.getBool(context, argument.name) is ListArgument<*> -> argument.parse(getParsedArgument(context, argument)) @@ -243,31 +246,31 @@ object ArgumentHelper { is com.undefined.stellar.argument.structure.LootTableArgument -> throwArgumentVersionException(argument) is UUIDArgument -> UuidArgument.getUuid(context, argument.name) is GameEventArgument -> org.bukkit.Registry.GAME_EVENT.get(getId(context, argument.name, Registries.GAME_EVENT)) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> org.bukkit.Registry.STRUCTURE_TYPE.get(getId(context, argument.name, Registries.STRUCTURE_TYPE)) + is StructureTypeArgument -> org.bukkit.Registry.STRUCTURE_TYPE.get(getId(context, argument.name, Registries.STRUCTURE_TYPE)) is PotionEffectTypeArgument -> throwArgumentVersionException(argument) is BlockTypeArgument -> throwArgumentVersionException(argument) is ItemTypeArgument -> throwArgumentVersionException(argument) is CatTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> org.bukkit.Registry.FROG_VARIANT.get(getId(context, argument.name, Registries.FROG_VARIANT)) + is FrogVariantArgument -> org.bukkit.Registry.FROG_VARIANT.get(getId(context, argument.name, Registries.FROG_VARIANT)) is VillagerProfessionArgument -> org.bukkit.Registry.VILLAGER_PROFESSION.get(getId(context, argument.name, Registries.VILLAGER_PROFESSION)) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name, Registries.VILLAGER_TYPE)) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> throwArgumentVersionException(argument) + is VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name, Registries.VILLAGER_TYPE)) + is MapDecorationTypeArgument -> throwArgumentVersionException(argument) is InventoryTypeArgument -> getInventoryType(resolveKey(context, argument.name, Registries.MENU).value()) - is com.undefined.stellar.argument.registry.AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name, Registries.ATTRIBUTE)) + is AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name, Registries.ATTRIBUTE)) is FluidArgument -> org.bukkit.Registry.FLUID.get(getId(context, argument.name, Registries.FLUID)) is SoundArgument -> org.bukkit.Registry.SOUNDS.get(getId(context, argument.name, Registries.SOUND_EVENT)) - is com.undefined.stellar.argument.registry.BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name, Registries.BIOME)) + is BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name, Registries.BIOME)) is StructureArgument -> org.bukkit.Registry.STRUCTURE.get(getId(context, argument.name, Registries.STRUCTURE)) is TrimMaterialArgument -> throwArgumentVersionException(argument) is TrimPatternArgument -> throwArgumentVersionException(argument) is DamageTypeArgument -> throwArgumentVersionException(argument) is WolfVariantArgument -> throwArgumentVersionException(argument) is PatternTypeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.ArtArgument -> org.bukkit.Registry.ART.get(getId(context, argument.name, Registries.PAINTING_VARIANT)) + is ArtArgument -> org.bukkit.Registry.ART.get(getId(context, argument.name, Registries.PAINTING_VARIANT)) is InstrumentArgument -> throwArgumentVersionException(argument) is EntityTypeArgument -> org.bukkit.Registry.ENTITY_TYPE.get(getId(context, argument.name, Registries.ENTITY_TYPE)) is PotionArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name, Registries.MEMORY_MODULE_TYPE)) + is MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name, Registries.MEMORY_MODULE_TYPE)) else -> throw UnsupportedArgumentException(argument) } } @@ -357,11 +360,11 @@ object ArgumentHelper { StringType.PHRASE -> StringArgumentType.greedyString() } - private fun brigadier(type: com.undefined.stellar.argument.entity.EntityDisplayType): EntityArgument = when (type) { - com.undefined.stellar.argument.entity.EntityDisplayType.ENTITY -> EntityArgument.entity() - com.undefined.stellar.argument.entity.EntityDisplayType.ENTITIES -> EntityArgument.entities() - com.undefined.stellar.argument.entity.EntityDisplayType.PLAYER -> EntityArgument.player() - com.undefined.stellar.argument.entity.EntityDisplayType.PLAYERS -> EntityArgument.players() + private fun brigadier(type: EntityDisplayType): EntityArgument = when (type) { + EntityDisplayType.ENTITY -> EntityArgument.entity() + EntityDisplayType.ENTITIES -> EntityArgument.entities() + EntityDisplayType.PLAYER -> EntityArgument.player() + EntityDisplayType.PLAYERS -> EntityArgument.players() } private fun getBukkitAxis(argument: EnumSet): EnumSet = diff --git a/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/BrigadierCommandHelper.kt b/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/BrigadierCommandHelper.kt index 9bcd72b..ef971c5 100644 --- a/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/BrigadierCommandHelper.kt +++ b/spigot/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt b/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt index 50e3d8e..255a058 100644 --- a/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt +++ b/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/BrigadierCommandHelper.kt b/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/BrigadierCommandHelper.kt index 817b8bf..c2f9cb0 100644 --- a/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/BrigadierCommandHelper.kt +++ b/spigot/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt b/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt index 2242856..e4d45d4 100644 --- a/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt +++ b/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/BrigadierCommandHelper.kt b/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/BrigadierCommandHelper.kt index eb9a086..7feecee 100644 --- a/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/BrigadierCommandHelper.kt +++ b/spigot/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt b/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt index c909586..763d679 100644 --- a/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt +++ b/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/BrigadierCommandHelper.kt b/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/BrigadierCommandHelper.kt index 0e7b5e9..b7a7029 100644 --- a/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/BrigadierCommandHelper.kt +++ b/spigot/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt b/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt index 82a5855..9fcfe0d 100644 --- a/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt +++ b/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument import net.minecraft.commands.arguments.coordinates.* diff --git a/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/BrigadierCommandHelper.kt b/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/BrigadierCommandHelper.kt index 1a62ec2..ec3c4d8 100644 --- a/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/BrigadierCommandHelper.kt +++ b/spigot/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt b/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt index c748bed..2bc59d4 100644 --- a/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt +++ b/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt @@ -33,7 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.ResourceOrIdArgument.LootTableArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument diff --git a/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/BrigadierCommandHelper.kt b/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/BrigadierCommandHelper.kt index cf1a1ae..d2051f6 100644 --- a/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/BrigadierCommandHelper.kt +++ b/spigot/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt b/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt index 7a19d2f..2526596 100644 --- a/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt +++ b/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt @@ -31,7 +31,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.ResourceOrIdArgument.LootTableArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument diff --git a/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/BrigadierCommandHelper.kt b/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/BrigadierCommandHelper.kt index bff8610..d0b2cf5 100644 --- a/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/BrigadierCommandHelper.kt +++ b/spigot/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt b/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt index bf843ca..b176440 100644 --- a/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt +++ b/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt @@ -31,7 +31,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.ResourceOrIdArgument.LootTableArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument @@ -96,7 +99,7 @@ object ArgumentHelper { is PhraseArgument -> brigadier(StringType.PHRASE) is IntegerArgument -> IntegerArgumentType.integer(argument.min, argument.max) is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.longArg(argument.min, argument.max) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) + is FloatArgument -> FloatArgumentType.floatArg(argument.min, argument.max) is DoubleArgument -> DoubleArgumentType.doubleArg(argument.min, argument.max) is BooleanArgument -> BoolArgumentType.bool() is com.undefined.stellar.argument.entity.EntityArgument -> brigadier(argument.type) @@ -142,31 +145,31 @@ object ArgumentHelper { is com.undefined.stellar.argument.structure.LootTableArgument -> LootTableArgument.lootTable(COMMAND_BUILD_CONTEXT) is UUIDArgument -> UuidArgument.uuid() is GameEventArgument -> ResourceKeyArgument.key(Registries.GAME_EVENT) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> ResourceKeyArgument.key(Registries.STRUCTURE_TYPE) + is StructureTypeArgument -> ResourceKeyArgument.key(Registries.STRUCTURE_TYPE) is PotionEffectTypeArgument -> ResourceKeyArgument.key(Registries.MOB_EFFECT) is BlockTypeArgument -> ResourceKeyArgument.key(Registries.BLOCK_TYPE) is ItemTypeArgument -> ResourceKeyArgument.key(Registries.ITEM) is CatTypeArgument -> ResourceKeyArgument.key(Registries.CAT_VARIANT) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> ResourceKeyArgument.key(Registries.FROG_VARIANT) + is FrogVariantArgument -> ResourceKeyArgument.key(Registries.FROG_VARIANT) is VillagerProfessionArgument -> ResourceKeyArgument.key(Registries.VILLAGER_PROFESSION) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> ResourceKeyArgument.key(Registries.VILLAGER_TYPE) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> ResourceKeyArgument.key(Registries.MAP_DECORATION_TYPE) + is VillagerTypeArgument -> ResourceKeyArgument.key(Registries.VILLAGER_TYPE) + is MapDecorationTypeArgument -> ResourceKeyArgument.key(Registries.MAP_DECORATION_TYPE) is InventoryTypeArgument -> ResourceKeyArgument.key(Registries.MENU) - is com.undefined.stellar.argument.registry.AttributeArgument -> ResourceKeyArgument.key(Registries.ATTRIBUTE) + is AttributeArgument -> ResourceKeyArgument.key(Registries.ATTRIBUTE) is FluidArgument -> ResourceKeyArgument.key(Registries.FLUID) is SoundArgument -> ResourceKeyArgument.key(Registries.SOUND_EVENT) - is com.undefined.stellar.argument.registry.BiomeArgument -> ResourceKeyArgument.key(Registries.BIOME) + is BiomeArgument -> ResourceKeyArgument.key(Registries.BIOME) is StructureArgument -> ResourceKeyArgument.key(Registries.STRUCTURE) is TrimMaterialArgument -> ResourceKeyArgument.key(Registries.TRIM_MATERIAL) is TrimPatternArgument -> ResourceKeyArgument.key(Registries.TRIM_PATTERN) is DamageTypeArgument -> ResourceKeyArgument.key(Registries.DAMAGE_TYPE) is WolfVariantArgument -> ResourceKeyArgument.key(Registries.WOLF_VARIANT) is PatternTypeArgument -> ResourceKeyArgument.key(Registries.BANNER_PATTERN) - is com.undefined.stellar.argument.registry.ArtArgument -> ResourceKeyArgument.key(Registries.PAINTING_VARIANT) + is ArtArgument -> ResourceKeyArgument.key(Registries.PAINTING_VARIANT) is InstrumentArgument -> ResourceKeyArgument.key(Registries.INSTRUMENT) is EntityTypeArgument -> ResourceKeyArgument.key(Registries.ENTITY_TYPE) is PotionArgument -> ResourceKeyArgument.key(Registries.POTION) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> ResourceKeyArgument.key(Registries.MEMORY_MODULE_TYPE) + is MemoryKeyArgument -> ResourceKeyArgument.key(Registries.MEMORY_MODULE_TYPE) else -> throw UnsupportedArgumentException(argument) } @@ -176,8 +179,8 @@ object ArgumentHelper { is CustomArgument<*> -> argument.parse(CommandContextAdapter.getStellarCommandContext(context)) is StringArgument -> StringArgumentType.getString(context, argument.name) is IntegerArgument -> IntegerArgumentType.getInteger(context, argument.name) - is com.undefined.stellar.argument.primitive.LongArgument -> LongArgumentType.getLong(context, argument.name) - is com.undefined.stellar.argument.primitive.FloatArgument -> FloatArgumentType.getFloat(context, argument.name) + is LongArgument -> LongArgumentType.getLong(context, argument.name) + is FloatArgument -> FloatArgumentType.getFloat(context, argument.name) is DoubleArgument -> DoubleArgumentType.getDouble(context, argument.name) is BooleanArgument -> BoolArgumentType.getBool(context, argument.name) is ListArgument<*> -> argument.parse(StringArgumentType.getString(context, argument.name)) @@ -240,31 +243,31 @@ object ArgumentHelper { is com.undefined.stellar.argument.structure.LootTableArgument -> LootTableArgument.getLootTable(context, argument.name).value().craftLootTable is UUIDArgument -> UuidArgument.getUuid(context, argument.name) is GameEventArgument -> org.bukkit.Registry.GAME_EVENT.get(getId(context, argument.name, Registries.GAME_EVENT)) - is com.undefined.stellar.argument.registry.StructureTypeArgument -> org.bukkit.Registry.STRUCTURE_TYPE.get(getId(context, argument.name, Registries.STRUCTURE_TYPE)) + is StructureTypeArgument -> org.bukkit.Registry.STRUCTURE_TYPE.get(getId(context, argument.name, Registries.STRUCTURE_TYPE)) is PotionEffectTypeArgument -> org.bukkit.Registry.EFFECT.get(getId(context, argument.name, Registries.MOB_EFFECT)) is BlockTypeArgument -> org.bukkit.Registry.BLOCK.get(getId(context, argument.name, Registries.BLOCK_TYPE)) is ItemTypeArgument -> org.bukkit.Registry.ITEM.get(getId(context, argument.name, Registries.ITEM)) is CatTypeArgument -> org.bukkit.Registry.CAT_VARIANT.get(getId(context, argument.name, Registries.CAT_VARIANT)) - is com.undefined.stellar.argument.registry.FrogVariantArgument -> org.bukkit.Registry.FROG_VARIANT.get(getId(context, argument.name, Registries.FROG_VARIANT)) + is FrogVariantArgument -> org.bukkit.Registry.FROG_VARIANT.get(getId(context, argument.name, Registries.FROG_VARIANT)) is VillagerProfessionArgument -> org.bukkit.Registry.VILLAGER_PROFESSION.get(getId(context, argument.name, Registries.VILLAGER_PROFESSION)) - is com.undefined.stellar.argument.registry.VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name, Registries.VILLAGER_TYPE)) - is com.undefined.stellar.argument.registry.MapDecorationTypeArgument -> org.bukkit.Registry.MAP_DECORATION_TYPE.get(getId(context, argument.name, Registries.MAP_DECORATION_TYPE)) + is VillagerTypeArgument -> org.bukkit.Registry.VILLAGER_TYPE.get(getId(context, argument.name, Registries.VILLAGER_TYPE)) + is MapDecorationTypeArgument -> org.bukkit.Registry.MAP_DECORATION_TYPE.get(getId(context, argument.name, Registries.MAP_DECORATION_TYPE)) is InventoryTypeArgument -> getInventoryType(resolveKey(context, argument.name, Registries.MENU).value()) - is com.undefined.stellar.argument.registry.AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name, Registries.ATTRIBUTE)) + is AttributeArgument -> org.bukkit.Registry.ATTRIBUTE.get(getId(context, argument.name, Registries.ATTRIBUTE)) is FluidArgument -> org.bukkit.Registry.FLUID.get(getId(context, argument.name, Registries.FLUID)) is SoundArgument -> org.bukkit.Registry.SOUNDS.get(getId(context, argument.name, Registries.SOUND_EVENT)) - is com.undefined.stellar.argument.registry.BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name, Registries.BIOME)) + is BiomeArgument -> org.bukkit.Registry.BIOME.get(getId(context, argument.name, Registries.BIOME)) is StructureArgument -> org.bukkit.Registry.STRUCTURE.get(getId(context, argument.name, Registries.STRUCTURE)) is TrimMaterialArgument -> org.bukkit.Registry.TRIM_MATERIAL.get(getId(context, argument.name, Registries.TRIM_MATERIAL)) is TrimPatternArgument -> org.bukkit.Registry.TRIM_PATTERN.get(getId(context, argument.name, Registries.TRIM_PATTERN)) is DamageTypeArgument -> org.bukkit.Registry.DAMAGE_TYPE.get(getId(context, argument.name, Registries.DAMAGE_TYPE)) is WolfVariantArgument -> org.bukkit.Registry.WOLF_VARIANT.get(getId(context, argument.name, Registries.WOLF_VARIANT)) is PatternTypeArgument -> org.bukkit.Registry.BANNER_PATTERN.get(getId(context, argument.name, Registries.BANNER_PATTERN)) - is com.undefined.stellar.argument.registry.ArtArgument -> org.bukkit.Registry.ART.get(getId(context, argument.name, Registries.PAINTING_VARIANT)) + is ArtArgument -> org.bukkit.Registry.ART.get(getId(context, argument.name, Registries.PAINTING_VARIANT)) is InstrumentArgument -> org.bukkit.Registry.INSTRUMENT.get(getId(context, argument.name, Registries.INSTRUMENT)) is EntityTypeArgument -> org.bukkit.Registry.ENTITY_TYPE.get(getId(context, argument.name, Registries.ENTITY_TYPE)) is PotionArgument -> org.bukkit.Registry.POTION.get(getId(context, argument.name, Registries.POTION)) - is com.undefined.stellar.argument.registry.MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name, Registries.MEMORY_MODULE_TYPE)) + is MemoryKeyArgument -> org.bukkit.Registry.MEMORY_MODULE_TYPE.get(getId(context, argument.name, Registries.MEMORY_MODULE_TYPE)) else -> throw UnsupportedArgumentException(argument) } } diff --git a/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/BrigadierCommandHelper.kt b/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/BrigadierCommandHelper.kt index 257a9d8..3d4088a 100644 --- a/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/BrigadierCommandHelper.kt +++ b/spigot/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file diff --git a/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt b/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt index 8ca5819..4648233 100644 --- a/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt +++ b/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt @@ -31,7 +31,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer import net.minecraft.commands.CommandBuildContext import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.arguments.* +import net.minecraft.commands.arguments.DimensionArgument import net.minecraft.commands.arguments.EntityAnchorArgument +import net.minecraft.commands.arguments.EntityArgument +import net.minecraft.commands.arguments.ParticleArgument import net.minecraft.commands.arguments.ResourceOrIdArgument.LootTableArgument import net.minecraft.commands.arguments.blocks.BlockPredicateArgument import net.minecraft.commands.arguments.blocks.BlockStateArgument diff --git a/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt b/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt index 9a08383..1f0bfdb 100644 --- a/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt +++ b/spigot/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/BrigadierCommandHelper.kt @@ -12,9 +12,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import net.minecraft.commands.CommandSourceStack import net.minecraft.server.MinecraftServer import org.bukkit.Bukkit -import org.bukkit.scheduler.BukkitRunnable import java.util.concurrent.CompletableFuture +@Suppress("DEPRECATION") object BrigadierCommandHelper { val COMMAND_SOURCE: CommandSourceStack by lazy { @@ -27,7 +27,7 @@ object BrigadierCommandHelper { fun handleHelpTopic(command: AbstractStellarCommand<*>) { Bukkit.getServer().helpMap.addTopic( - CustomCommandHelpTopic(command.name, command.description, command.helpTopic) { + CustomCommandHelpTopic(command.name, command.description, command.information) { val context = MinecraftServer.getServer().createCommandSourceStack() val requirements = command.requirements.all { it(this) } val permissionRequirements = command.permissionRequirements.all { @@ -88,9 +88,3 @@ object BrigadierCommandHelper { } } - -fun sync(execution: () -> Unit) { - object : BukkitRunnable() { - override fun run() = execution() - }.runTask(CommandRegistrar.plugin) -} \ No newline at end of file