From 7419fecb40c1c5599c1f7f1f32676883f687e987 Mon Sep 17 00:00:00 2001 From: TheFruxz Date: Sat, 8 Oct 2022 17:43:24 +0200 Subject: [PATCH] chore: update ascend & stacked --- build.gradle.kts | 4 ++-- .../de/fruxz/sparkle/framework/extension/scoreboard/Team.kt | 3 ++- .../kotlin/de/fruxz/sparkle/framework/visual/item/Item.kt | 3 ++- .../fruxz/sparkle/server/component/ui/gui/CanvasListener.kt | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c45e826b2c..35b215e2d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,8 +23,8 @@ repositories { maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") // PlaceholderAPI } -val ascendVersion = "1.0.0-RC4b" -val stackedVersion = "1.0.0-RC2" +val ascendVersion = "1.0.0" +val stackedVersion = "1.0.0" dependencies { diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/extension/scoreboard/Team.kt b/src/main/kotlin/de/fruxz/sparkle/framework/extension/scoreboard/Team.kt index 3a4b42e1a7..1de75d89e5 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/extension/scoreboard/Team.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/extension/scoreboard/Team.kt @@ -1,5 +1,6 @@ package de.fruxz.sparkle.framework.extension.scoreboard +import de.fruxz.ascend.extension.container.takeOrEmpty import de.fruxz.sparkle.framework.extension.offlinePlayer import org.bukkit.OfflinePlayer import org.bukkit.entity.Player @@ -13,7 +14,7 @@ import org.bukkit.scoreboard.Team * @since 1.0 */ val Team?.entriesAsOfflinePlayer: List - get() = this?.entries?.map { offlinePlayer(it) } ?: emptyList() + get() = this?.entries?.map { offlinePlayer(it) }.takeOrEmpty() /** * This value returns every entry from the [entriesAsOfflinePlayer] function, mapped to a [Player] object. diff --git a/src/main/kotlin/de/fruxz/sparkle/framework/visual/item/Item.kt b/src/main/kotlin/de/fruxz/sparkle/framework/visual/item/Item.kt index b2025d9009..466b5614db 100644 --- a/src/main/kotlin/de/fruxz/sparkle/framework/visual/item/Item.kt +++ b/src/main/kotlin/de/fruxz/sparkle/framework/visual/item/Item.kt @@ -1,5 +1,6 @@ package de.fruxz.sparkle.framework.visual.item +import de.fruxz.ascend.extension.container.takeOrEmpty import de.fruxz.ascend.extension.data.buildRandomTag import de.fruxz.ascend.extension.forceCast import de.fruxz.ascend.extension.objects.takeIfInstance @@ -84,7 +85,7 @@ data class Item( material = itemStack.type, label = itemStack.itemMeta?.displayName() ?: Component.empty(), size = itemStack.amount, - lore = itemStack.lore() ?: emptyList(), + lore = itemStack.lore().takeOrEmpty(), damage = itemStack.itemMeta?.takeIfInstance()?.damage ?: 0, modifications = enchantmentsToModifications(itemStack.enchantments).toMutableSet(), flags = itemStack.itemFlags, diff --git a/src/main/kotlin/de/fruxz/sparkle/server/component/ui/gui/CanvasListener.kt b/src/main/kotlin/de/fruxz/sparkle/server/component/ui/gui/CanvasListener.kt index 189def133c..bc40c06ee2 100644 --- a/src/main/kotlin/de/fruxz/sparkle/server/component/ui/gui/CanvasListener.kt +++ b/src/main/kotlin/de/fruxz/sparkle/server/component/ui/gui/CanvasListener.kt @@ -1,6 +1,7 @@ package de.fruxz.sparkle.server.component.ui.gui import de.fruxz.ascend.extension.container.edited +import de.fruxz.ascend.extension.container.takeOrEmpty import de.fruxz.ascend.extension.empty import de.fruxz.ascend.extension.math.ceilToInt import de.fruxz.ascend.extension.math.maxTo @@ -154,7 +155,7 @@ internal class CanvasListener : EventListener() { if (!canvas.flags.contains(NO_CLICK_ACTIONS)) { session.canvas.onClicks - .let { (it[null] ?: emptyList()) + (it[event.slot] ?: emptyList()) } + .let { (it[null].takeOrEmpty()) + (it[event.slot].takeOrEmpty()) } .forEach { it.invoke(internalEvent) } }