Cleanup for Merge

Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
2026-06-10 21:43:02 +02:00
parent a6681ffaf6
commit 8050f51424
5 changed files with 4 additions and 97 deletions
@@ -1,50 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2026 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.kotlin.ui
import de.steamwar.kotlin.ui.components.item
import org.bukkit.Material
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
class TestInv(player: Player): UIInventory(player) {
override fun view() {
inventory(3, title = "TEST_TITLE") {
group {
item {
var test by Test.test.listen()
x = test % 9
y = 1
item = ItemStack.of(Material.STONE, test)
onClick {
test++
}
}
}
}
}
}
object Test {
val test = Observer(1)
}
@@ -70,9 +70,8 @@ class UIWindow(val player: Player, val render: WindowContext.() -> Unit): Invent
@EventHandler
fun onInventoryClick(event: InventoryClickEvent) {
if (event.inventory.holder is UIWindow) {
val window = event.inventory.holder as UIWindow
val window = event.inventory.holder
if (window is UIWindow) {
event.isCancelled = true
if (window.context.skipDoubleClick && event.click == ClickType.DOUBLE_CLICK) return
@@ -82,9 +81,8 @@ class UIWindow(val player: Player, val render: WindowContext.() -> Unit): Invent
@EventHandler
fun onInventoryClose(event: InventoryCloseEvent) {
if (event.inventory.holder is UIWindow) {
val window = event.inventory.holder as UIWindow
val window = event.inventory.holder
if (window is UIWindow) {
window.onClose()
}
}
@@ -48,5 +48,3 @@ fun ItemStack.hideAttributes() = apply { itemMeta = itemMeta.also { it.addItemFl
fun ItemStack.enchanted() = apply { itemMeta = itemMeta.also { it.addEnchant(Enchantment.UNBREAKING, 10, true) } }
fun ItemStack.customModelData(model: CustomModelDataComponent) = apply { itemMeta = itemMeta.also { it.setCustomModelDataComponent(model) } }