Skip to content

Commit 0dca376

Browse files
authored
Fix/fix command api (#275)
2 parents 3b5da5d + fc0391c commit 0dca376

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
77
javaVersion=25
88
mcVersion=1.21.11
99
group=dev.slne.surf
10-
version=1.21.11-2.73.1
10+
version=1.21.11-2.73.2
1111
relocationPrefix=dev.slne.surf.surfapi.libs
1212
snapshot=false

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ packetevents = "2.11.2"
1616
packetevents-plugin = "2.11.2"
1717

1818
# Command API
19-
commandapi = "11.1.0"
19+
commandapi = "11.2.0"
2020

2121
# LuckPerms
2222
luckperms = "v5.5.0-bukkit"

surf-api-bukkit/surf-api-bukkit-api/src/main/kotlin/dev/slne/surf/surfapi/bukkit/api/command/args/AdventureCompoundBinaryTagArgument.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import net.kyori.adventure.nbt.TagStringIO
1515
@OptIn(NmsUseWithCaution::class)
1616
class AdventureCompoundBinaryTagArgument(nodeName: String) :
1717
SafeOverrideableArgument<CompoundBinaryTag, CompoundBinaryTag>(
18-
nodeName, commandArgumentTypes.compoundTag(), { TagStringIO.tagStringIO().asString(it) }
18+
nodeName, commandArgumentTypes::compoundTag, { TagStringIO.tagStringIO().asString(it) }
1919
) {
2020
override fun getPrimitiveType(): Class<CompoundBinaryTag> {
2121
return CompoundBinaryTag::class.java
@@ -38,17 +38,20 @@ inline fun CommandTree.adventureCompoundBinaryTagArgument(
3838
nodeName: String,
3939
optional: Boolean = false,
4040
block: Argument<*>.() -> Unit = {}
41-
): CommandTree = then(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))
41+
): CommandTree =
42+
then(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))
4243

4344
inline fun Argument<*>.adventureCompoundBinaryTagArgument(
4445
nodeName: String,
4546
optional: Boolean = false,
4647
block: Argument<*>.() -> Unit = {}
47-
): Argument<*> = then(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))
48+
): Argument<*> =
49+
then(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))
4850

4951

5052
inline fun CommandAPICommand.adventureCompoundBinaryTagArgument(
5153
nodeName: String,
5254
optional: Boolean = false,
5355
block: Argument<*>.() -> Unit = {}
54-
): CommandAPICommand = withArguments(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))
56+
): CommandAPICommand =
57+
withArguments(AdventureCompoundBinaryTagArgument(nodeName).setOptional(optional).apply(block))

surf-api-velocity/surf-api-velocity-api/src/main/kotlin/dev/slne/surf/surfapi/velocity/api/command/args/MiniMessageArgument.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage
1414
import net.kyori.adventure.text.minimessage.ParsingException
1515

1616
open class MiniMessageArgument(nodeName: String) :
17-
Argument<Component>(nodeName, StringArgumentType.string()) {
17+
Argument<Component>(nodeName, StringArgumentType::string) {
1818
override fun getPrimitiveType(): Class<Component> {
1919
return Component::class.java
2020
}

surf-api-velocity/surf-api-velocity-api/src/main/kotlin/dev/slne/surf/surfapi/velocity/api/command/args/SuspendCustomArgument.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ import java.util.concurrent.CompletableFuture
3232
abstract class SuspendCustomArgument<T, B>(
3333
private val base: Argument<B>,
3434
private val scope: CoroutineScope = defaultScope
35-
) : Argument<Deferred<T>>(base.nodeName, base.rawType) {
35+
) : Argument<Deferred<T>>(base.nodeName, {
36+
base.rawType
37+
}) {
3638
private val primitiveType by lazy { object : TypeToken<Deferred<T>>(javaClass) {} }
3739

3840
override fun instance() = this
@@ -42,7 +44,10 @@ abstract class SuspendCustomArgument<T, B>(
4244

4345
protected abstract inner class SuspendArgumentSuggestions : ArgumentSuggestions<CommandSource> {
4446
@Throws(CommandSyntaxException::class)
45-
abstract suspend fun CoroutineScope.suggest(info: SuggestionInfo<CommandSource>, builder: SuggestionsBuilder)
47+
abstract suspend fun CoroutineScope.suggest(
48+
info: SuggestionInfo<CommandSource>,
49+
builder: SuggestionsBuilder
50+
)
4651

4752
final override fun suggest(
4853
info: SuggestionInfo<CommandSource>,

0 commit comments

Comments
 (0)