File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
surf-npc-api/src/main/kotlin/dev/slne/surf/npc/api/dsl
surf-npc-example-dsl/src/main/kotlin/dev/slne/surf/npc/example Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 11kotlin.code.style =official
22kotlin.stdlib.default.dependency =false
33org.gradle.parallel =true
4- version =1.21.7-1.0.1 -SNAPSHOT
4+ version =1.21.7-1.1.0 -SNAPSHOT
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import dev.slne.surf.npc.api.npc.rotation.NpcRotationType
77import dev.slne.surf.npc.api.npc.skin.NpcSkin
88import dev.slne.surf.npc.api.result.NpcCreationResult
99import dev.slne.surf.npc.api.surfNpcApi
10- import net.kyori.adventure.text.Component
10+ import dev.slne.surf.surfapi.core.api.messages.builder.SurfComponentBuilder
1111
1212/* *
1313 * Builder class for creating NPCs using a DSL.
@@ -16,7 +16,7 @@ class NpcDslBuilder {
1616 /* *
1717 * The display name of the NPC.
1818 */
19- lateinit var displayName: Component
19+ lateinit var displayName: SurfComponentBuilder .() -> Unit
2020
2121 /* *
2222 * The unique name of the NPC.
@@ -135,7 +135,7 @@ suspend fun skin(name: String): NpcSkin {
135135fun npc (block : NpcDslBuilder .() -> Unit ): NpcCreationResult {
136136 val builder = NpcDslBuilder ().apply (block)
137137 return surfNpcApi.createNpc(
138- displayName = builder. displayName,
138+ displayName = SurfComponentBuilder . builder(). apply (builder. displayName).build() ,
139139 uniqueName = builder.uniqueName,
140140 skin = builder.skin,
141141 location = builder.location,
Original file line number Diff line number Diff line change @@ -19,8 +19,13 @@ class SurfNpcExamplePlugin() : SuspendingJavaPlugin() {
1919 * Creates an example NPC using the DSL provided by the Surf-NPC API.
2020 */
2121 npc {
22- displayName =
23- MiniMessage .miniMessage().deserialize(" <rainbow>Example Npc by surf-npc-example" )
22+ displayName = {
23+ append(
24+ MiniMessage .miniMessage()
25+ .deserialize(" <rainbow>Example Npc by surf-npc-example" )
26+ )
27+ }
28+
2429 uniqueName = " example_npc"
2530
2631 /* *
You can’t perform that action at this time.
0 commit comments