Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 954a300

Browse files
committed
refactor some stuff, fix(gradle-plugin): only run on the jvm
1 parent b471dc4 commit 954a300

File tree

26 files changed

+97
-60
lines changed

26 files changed

+97
-60
lines changed

bom/build.gradle.kts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2+
id("axi.publishing-repo-conventions")
23
`java-platform`
3-
`maven-publish`
44
}
55

66
group = "net.radstevee.axi"
@@ -24,16 +24,4 @@ publishing {
2424
from(components["javaPlatform"])
2525
}
2626
}
27-
28-
repositories {
29-
maven {
30-
name = "radPublic"
31-
url = uri("https://maven.radsteve.net/public")
32-
33-
credentials {
34-
username = System.getenv("RAD_MAVEN_USER")
35-
password = System.getenv("RAD_MAVEN_TOKEN")
36-
}
37-
}
38-
}
3927
}

buildSrc/src/main/kotlin/axi.kotlin-conventions.gradle.kts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
kotlin("plugin.serialization")
99
id("org.jetbrains.dokka")
1010
id("com.diffplug.spotless")
11+
id("axi.publishing-repo-conventions")
1112

1213
`maven-publish`
1314
`java-library`
@@ -81,18 +82,6 @@ publishing {
8182
}
8283
}
8384
}
84-
85-
repositories {
86-
maven {
87-
name = "radPublic"
88-
url = uri("https://maven.radsteve.net/public")
89-
90-
credentials {
91-
username = System.getenv("RAD_MAVEN_USER")
92-
password = System.getenv("RAD_MAVEN_TOKEN")
93-
}
94-
}
95-
}
9685
}
9786

9887
java {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
`maven-publish`
3+
}
4+
5+
publishing {
6+
repositories {
7+
maven {
8+
name = "radPublic"
9+
url = uri("https://maven.radsteve.net/public")
10+
11+
credentials {
12+
username = System.getenv("RAD_MAVEN_USER")
13+
password = System.getenv("RAD_MAVEN_TOKEN")
14+
}
15+
}
16+
}
17+
}

core/src/main/kotlin/net/radstevee/axi/command/CommandArguments.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
package net.radstevee.axi.command
44

55
import kotlinx.coroutines.InternalCoroutinesApi
6-
import kotlinx.coroutines.internal.intellij.IntellijCoroutines
6+
import net.radstevee.axi.command.internal.CloudCommandExecutionContext
77
import org.incendo.cloud.paper.util.sender.Source
88
import org.incendo.cloud.parser.ParserDescriptor
99
import kotlin.reflect.KProperty

core/src/main/kotlin/net/radstevee/axi/command/CommandBuilder.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.radstevee.axi.command
22

3+
import net.radstevee.axi.command.internal.CommandImpl
34
import net.radstevee.axi.plugin.AxiPlugin
45
import org.bukkit.entity.Player
56
import org.incendo.cloud.paper.util.sender.Source
@@ -51,6 +52,12 @@ public class CommandBuilder(
5152
return arg
5253
}
5354

55+
/** Adds the given [arg] to this command. */
56+
public fun <T : Any> arg(arg: CommandArgument<T>): CommandArgument<T> {
57+
args.add(arg)
58+
return arg
59+
}
60+
5461
/** Sets the executor of this command. */
5562
public fun executor(block: suspend CommandExecutionContext.() -> Unit) {
5663
executor = block
@@ -94,4 +101,4 @@ public class CommandBuilder(
94101

95102
@DslMarker
96103
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS)
97-
public annotation class CommandBuilderDsl
104+
internal annotation class CommandBuilderDsl

core/src/main/kotlin/net/radstevee/axi/command/CommandRegistration.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.radstevee.axi.command
22

33
import kotlinx.coroutines.coroutineScope
4+
import net.radstevee.axi.command.internal.CloudCommandExecutionContext
45
import net.radstevee.axi.coroutines.AxiCoroutines.asyncContext
56
import net.radstevee.axi.coroutines.AxiCoroutines.coroutineScope
67
import net.radstevee.axi.coroutines.AxiCoroutines.syncContext
@@ -43,13 +44,13 @@ public fun Command.register(manager: CommandManager = AxiPluginHolder.plugin().c
4344
suspendingHandler(scope = coroutineScope, context = coroutineContext) { ctx ->
4445
coroutineScope {
4546
val executionContext = CloudCommandExecutionContext(ctx, coroutineContext, this)
46-
CloudCommandExecutionContext.Holder.set(executionContext)
47+
CloudCommandExecutionContext.Companion.Holder.set(executionContext)
4748
try {
4849
with(command) {
4950
executionContext.execute()
5051
}
5152
} finally {
52-
CloudCommandExecutionContext.Holder.remove()
53+
CloudCommandExecutionContext.Companion.Holder.remove()
5354
}
5455
}
5556
}

core/src/main/kotlin/net/radstevee/axi/command/CloudCommandExecutionContext.kt renamed to core/src/main/kotlin/net/radstevee/axi/command/internal/CloudCommandExecutionContext.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
package net.radstevee.axi.command
1+
package net.radstevee.axi.command.internal
22

33
import kotlinx.coroutines.CoroutineScope
4+
import net.radstevee.axi.command.CommandExecutionContext
5+
import net.radstevee.axi.command.player
46
import org.bukkit.entity.Player
57
import org.incendo.cloud.context.CommandContext
68
import org.incendo.cloud.paper.util.sender.Source

core/src/main/kotlin/net/radstevee/axi/command/CommandImpl.kt renamed to core/src/main/kotlin/net/radstevee/axi/command/internal/CommandImpl.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
package net.radstevee.axi.command
1+
package net.radstevee.axi.command.internal
22

3-
/** A basic implementation of a [Command]. */
3+
import net.radstevee.axi.command.Command
4+
import net.radstevee.axi.command.CommandArgument
5+
import net.radstevee.axi.command.CommandExecutionContext
6+
7+
/** A basic implementation of a [net.radstevee.axi.command.Command]. */
48
public class CommandImpl(
59
override val name: String,
610
override val aliases: Set<String>,

core/src/main/kotlin/net/radstevee/axi/ecs/ECS.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public interface ECS : KoinComponent {
2929
/** Gets all entities in the ECS. */
3030
public fun entities(): Set<Attachable>
3131

32+
/** Retrieves the id of the given [componentKlass], or assigns one. */
33+
public fun id(componentKlass: KClass<out Any>): Int
34+
3235
/** The ECS implementation. */
3336
public companion object : ECS by AxiPluginHolder.plugin().get()
3437
}

core/src/main/kotlin/net/radstevee/axi/ecs/Ext.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
@file:JvmName("ECSExtensions")
2+
@file:JvmMultifileClass
3+
14
package net.radstevee.axi.ecs
25

36
import net.radstevee.axi.ecs.component.DebounceComponent
47
import net.radstevee.axi.ecs.component.EntityClickedComponent
58
import net.radstevee.axi.ecs.component.identity
9+
import net.radstevee.axi.ecs.internal.PlayerTracker
610
import org.bukkit.Bukkit
711
import org.bukkit.entity.Player
812
import kotlin.properties.ReadWriteProperty

0 commit comments

Comments
 (0)