forked from SteamWar/SteamWar
@@ -1,38 +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.bausystem.features;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.kotlin.ui.TestInv;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked
|
||||
public class TestCommand extends SWCommand {
|
||||
public TestCommand() {
|
||||
super("supertestcommand");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(Player player) {
|
||||
TestInv inv = new TestInv(player);
|
||||
inv.open();
|
||||
}
|
||||
}
|
||||
@@ -39,5 +39,4 @@ tasks.register<DevServer>("DevBau21") {
|
||||
dependsOn(":SchematicSystem:shadowJar")
|
||||
dependsOn(":KotlinCore:shadowJar")
|
||||
template = "Bau21"
|
||||
worldName = "73"
|
||||
}
|
||||
|
||||
@@ -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) } }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user