From f9406cfde15f2402c05b72788704b721980ab9cf Mon Sep 17 00:00:00 2001 From: TheFruxz Date: Sat, 22 Oct 2022 19:10:18 +0200 Subject: [PATCH] chore: code improvements and better naming --- .../de/fruxz/sparkle/framework/effect/ComplexEffect.kt | 2 -- .../sparkle/framework/event/canvas/CanvasUpdateEvent.kt | 5 ++++- .../de/fruxz/sparkle/framework/visual/canvas/Canvas.kt | 2 +- .../fruxz/sparkle/framework/visual/canvas/MutableCanvas.kt | 2 +- .../fruxz/sparkle/framework/visual/canvas/PaginationType.kt | 6 +++--- .../sparkle/server/interchange/PlaygroundInterchange.kt | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/effect/ComplexEffect.kt b/src/main/kotlin/de/fruxz/sparkle/framework/effect/ComplexEffect.kt index 312758c09c..6d91fe15b6 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/effect/ComplexEffect.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/effect/ComplexEffect.kt @@ -30,6 +30,4 @@ data class ComplexEffect( effects += effect } - - } diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/event/canvas/CanvasUpdateEvent.kt b/src/main/kotlin/de/fruxz/sparkle/framework/event/canvas/CanvasUpdateEvent.kt index 108945bebd..6ad8a6ee65 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/event/canvas/CanvasUpdateEvent.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/event/canvas/CanvasUpdateEvent.kt @@ -1,6 +1,7 @@ package de.fruxz.sparkle.framework.event.canvas import de.fruxz.sparkle.framework.visual.canvas.Canvas +import de.fruxz.sparkle.framework.visual.canvas.Canvas.ExperimentalCanvasApi import net.kyori.adventure.key.Key import org.bukkit.entity.Player import org.bukkit.event.HandlerList @@ -26,7 +27,9 @@ class CanvasUpdateEvent( } enum class UpdateReason { - PLUGIN, SCROLL, PAGE_TURN; + PLUGIN, + @ExperimentalCanvasApi SCROLL, + @ExperimentalCanvasApi PAGE_TURN; } } diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/Canvas.kt b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/Canvas.kt index ab711e6773..4b5ea23315 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/Canvas.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/Canvas.kt @@ -359,6 +359,6 @@ open class Canvas( @MustBeDocumented @RequiresOptIn(message = "This api is still in development and may not work like expected and may change in the future") - annotation class CanvasPrototypeAPI + annotation class ExperimentalCanvasApi } \ No newline at end of file diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/MutableCanvas.kt b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/MutableCanvas.kt index e7541cf409..7ad92f47b3 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/MutableCanvas.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/MutableCanvas.kt @@ -79,7 +79,7 @@ data class MutableCanvas( fun base(inventoryType: InventoryType) = base(Companion.ofType(inventoryType)) @CanvasDsl - @CanvasPrototypeAPI + @ExperimentalCanvasApi fun pagination(pagination: PaginationType<*>) { this.pagination = pagination } diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/PaginationType.kt b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/PaginationType.kt index cbe4bf44d1..7fd35a5f08 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/PaginationType.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/visual/canvas/PaginationType.kt @@ -7,7 +7,7 @@ import de.fruxz.sparkle.framework.extension.subNamespacedKey import de.fruxz.sparkle.framework.extension.sparkle import de.fruxz.sparkle.framework.extension.visual.ui.item import de.fruxz.sparkle.framework.extension.visual.ui.skull -import de.fruxz.sparkle.framework.visual.canvas.Canvas.CanvasPrototypeAPI +import de.fruxz.sparkle.framework.visual.canvas.Canvas.ExperimentalCanvasApi import de.fruxz.sparkle.framework.visual.canvas.PaginationType.Companion.PaginationBase.PAGED import de.fruxz.sparkle.framework.visual.canvas.PaginationType.Companion.PaginationBase.SCROLL import de.fruxz.sparkle.framework.visual.item.Item @@ -36,7 +36,7 @@ interface PaginationType { override fun contentRendering(scrollState: Int, lines: Int, contents: Map) = contents } - @CanvasPrototypeAPI + @ExperimentalCanvasApi fun scroll(configuration: ScrollControlSetup = ScrollControlSetup()) = object : PaginationType { override val base: PaginationBase = SCROLL @@ -83,7 +83,7 @@ interface PaginationType { } } - @CanvasPrototypeAPI + @ExperimentalCanvasApi fun paged(configuration: PageControlSetup = PageControlSetup()) = object : PaginationType { override val base: PaginationBase = PAGED diff --git a/src/main/kotlin/de/fruxz/sparkle/server/interchange/PlaygroundInterchange.kt b/src/main/kotlin/de/fruxz/sparkle/server/interchange/PlaygroundInterchange.kt index 2567b6e6d9..b83cb05dca 100644 --- a/src/main/kotlin/de/fruxz/sparkle/server/interchange/PlaygroundInterchange.kt +++ b/src/main/kotlin/de/fruxz/sparkle/server/interchange/PlaygroundInterchange.kt @@ -11,7 +11,7 @@ import de.fruxz.sparkle.framework.extension.visual.ui.skull import de.fruxz.sparkle.framework.infrastructure.command.completion.buildInterchangeStructure import de.fruxz.sparkle.framework.infrastructure.command.completion.content.CompletionAsset import de.fruxz.sparkle.framework.infrastructure.command.structured.StructuredInterchange -import de.fruxz.sparkle.framework.visual.canvas.Canvas.CanvasPrototypeAPI +import de.fruxz.sparkle.framework.visual.canvas.Canvas.ExperimentalCanvasApi import de.fruxz.sparkle.framework.visual.canvas.PaginationType import de.fruxz.sparkle.framework.visual.canvas.buildCanvas import de.fruxz.sparkle.framework.visual.color.ColorType @@ -96,7 +96,7 @@ internal class PlaygroundInterchange : StructuredInterchange("playground", build } - val canvasScrollable = @OptIn(CanvasPrototypeAPI::class) + val canvasScrollable = @OptIn(ExperimentalCanvasApi::class) buildCanvas { label("Hello!") pagination(PaginationType.scroll())