.
Pull Request Build / Build (pull_request) Successful in 1m19s

This commit is contained in:
D4rkr34lm
2026-06-12 16:50:26 +02:00
parent 34e7c62768
commit 9606c6bc0d
10 changed files with 62 additions and 39 deletions
+3 -9
View File
@@ -18,8 +18,7 @@
*/
plugins {
steamwar.java
kotlin("jvm") version "2.4.0"
steamwar.kotlin
}
tasks.compileJava {
@@ -27,6 +26,8 @@ tasks.compileJava {
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
dependencies {
@@ -45,11 +46,4 @@ dependencies {
implementation(libs.luaj)
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
implementation(kotlin("stdlib-jdk8"))
}
repositories {
mavenCentral()
}
kotlin {
jvmToolchain(21)
}
@@ -22,6 +22,7 @@ package de.steamwar.bausystem;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.configplayer.ConfigConverter;
import de.steamwar.bausystem.features.cannonCore.CannonCoreRegistrationKt;
import de.steamwar.bausystem.features.gui.BauGUI;
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
@@ -135,6 +136,8 @@ public class BauSystem extends JavaPlugin implements Listener {
String identifier = BauServerInfo.getOwnerUser().getUUID().toString().replace("-", "");
WorldIdentifier.set("bau/" + Core.getVersion() + "/" + identifier);
CannonCoreRegistrationKt.register(this);
}
@EventHandler
@@ -24,7 +24,6 @@ import de.steamwar.command.SWCommand
import de.steamwar.linkage.Linked
import org.bukkit.entity.Player
@Linked
object CannonCoreCommand : SWCommand("cannoncore") {
@Register
@@ -40,7 +40,7 @@ class CannonCoreEntity: RBlockDisplay {
}
override fun die() {
this.die()
super.die()
hitbox.die()
}
}
@@ -0,0 +1,29 @@
/*
* 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.cannonCore
import org.bukkit.plugin.Plugin
fun register(plugin: Plugin) {
CannonCoreCommand.register()
val pluginManager = plugin.server.pluginManager
pluginManager.registerEvents(CannonCoreWand, plugin)
}
@@ -22,21 +22,19 @@ package de.steamwar.bausystem.features.cannonCore
import de.steamwar.bausystem.utils.ItemUtils
import de.steamwar.core.SWPlayer
import de.steamwar.inventory.SWItem
import de.steamwar.linkage.Linked
import org.bukkit.Material
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerItemHeldEvent
import org.bukkit.inventory.ItemStack
@Linked
object CannonCoreWand: Listener {
val wandId = "CANNON_CORE_WAND"
val wandMaterial = Material.BREEZE_ROD
fun getWandItem(): ItemStack {
val title = "Cannon Core Wand"
val title = "§eCannon Core Wand"
val lore = listOf(
"§eRight Click §8- §7Create a new cannon core"
)
@@ -60,9 +58,7 @@ object CannonCoreWand: Listener {
swPlayer.removeComponent(EmptyCannonCoreWandDisplay::class.java)
}
else {
// TODO add handling for bound wand
val newCursor = EmptyCannonCoreWandDisplay(player)
swPlayer.setComponent(newCursor)
EmptyCannonCoreWandDisplay(player)
}
}
}
}
@@ -28,15 +28,18 @@ class CannonCoresDisplay: SWPlayer.Component {
val unlisten: () -> Unit
constructor(owner: Player) {
displayServer.addPlayer(owner)
unlisten = CannonCore.activeCores.observe( { cores ->
displayServer.entities.forEach { it.die() }
cores.forEach { CannonCoreEntity(displayServer, it.location) { _, _ -> println("Handler clicked at ${it.location}") } }
})
}
override fun onUnmount(player: SWPlayer?) {
super.onUnmount(player)
unlisten()
override fun onMount(player: SWPlayer) {
displayServer.addPlayer(player.player)
}
}
override fun onUnmount(player: SWPlayer?) {
unlisten()
displayServer.close()
}
}
@@ -21,12 +21,8 @@ package de.steamwar.bausystem.features.cannonCore
import de.steamwar.core.SWPlayer
import de.steamwar.cursor.Cursor
import de.steamwar.entity.REntity
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.entity.Player
import org.bukkit.event.block.Action
import java.util.Optional
class EmptyCannonCoreWandDisplay : SWPlayer.Component {
val coresDisplay: CannonCoresDisplay
@@ -43,5 +39,11 @@ class EmptyCannonCoreWandDisplay : SWPlayer.Component {
) { location, hitEntity, action ->
print("Hello")
}
SWPlayer.of(owner).setComponent(this)
}
override fun onUnmount(player: SWPlayer) {
player.removeComponent(cursor::class.java)
}
}
@@ -20,29 +20,30 @@
package de.steamwar.bausystem.utils;
import de.steamwar.bausystem.SWUtils;
import lombok.experimental.UtilityClass;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
@UtilityClass
public class ItemUtils {
public final class ItemUtils {
private final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
private static final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
public boolean isItem(ItemStack itemStack, String tag) {
private ItemUtils() {
}
public static boolean isItem(ItemStack itemStack, String tag) {
String value = getTag(itemStack, ITEM_KEY);
return value != null && value.equals(tag);
}
public ItemStack setItem(ItemStack itemStack, String tag) {
public static ItemStack setItem(ItemStack itemStack, String tag) {
setTag(itemStack, ITEM_KEY, tag);
return itemStack;
}
public String getTag(ItemStack itemStack, NamespacedKey key) {
public static String getTag(ItemStack itemStack, NamespacedKey key) {
if (itemStack == null) {
return null;
}
@@ -57,7 +58,7 @@ public class ItemUtils {
return container.get(key, PersistentDataType.STRING);
}
public void setTag(ItemStack itemStack, NamespacedKey key, String value) {
public static void setTag(ItemStack itemStack, NamespacedKey key, String value) {
if (itemStack == null) {
return;
}
-4
View File
@@ -21,10 +21,6 @@ import org.apache.tools.ant.taskdefs.condition.Os
import java.net.URI
import java.util.*
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
}
rootProject.name = "SteamWar"
private val isInCi by lazy { Os.isFamily(Os.FAMILY_UNIX) && ProcessBuilder("hostname").start().inputStream.bufferedReader().readText().startsWith("steamwar.de") }