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