diff --git a/FightSystem/build.gradle.kts b/FightSystem/build.gradle.kts index b999bdef..40cba603 100644 --- a/FightSystem/build.gradle.kts +++ b/FightSystem/build.gradle.kts @@ -67,9 +67,10 @@ tasks.register("WarGear21") { description = "Run a WarGear 1.21 Fight Server" dependsOn(":SpigotCore:shadowJar") dependsOn(":FightSystem:shadowJar") + dependsOn(":KotlinCore:shadowJar") template = "WarGear21" - worldName = "arenas/Pentraki" - config = "WarGear20.yml" + worldName = "arenas/Colosso" + config = "WarGear21.yml" jar = "/jars/paper-1.21.6.jar" } diff --git a/ModularFightSystem/FightSystem/build.gradle.kts b/ModularFightSystem/FightSystem/build.gradle.kts new file mode 100644 index 00000000..57f5f123 --- /dev/null +++ b/ModularFightSystem/FightSystem/build.gradle.kts @@ -0,0 +1,32 @@ +/* + * 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 . + */ + +plugins { + steamwar.kotlin + alias(libs.plugins.shadow) +} + +java { + targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 +} + +dependencies { + implementation(project(":ModularFightSystem:GameCore")) +} diff --git a/ModularFightSystem/FightSystem/src/FightSystem.kt b/ModularFightSystem/FightSystem/src/FightSystem.kt new file mode 100644 index 00000000..3feae9ae --- /dev/null +++ b/ModularFightSystem/FightSystem/src/FightSystem.kt @@ -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 . + */ + +package de.steamwar.fightsystem + +import de.steamwar.fightsystem.state.FightState + +class FightSystem { +} + +fun test() { + FightState.register() +} \ No newline at end of file diff --git a/ModularFightSystem/FightSystem/src/state/FightState.kt b/ModularFightSystem/FightSystem/src/state/FightState.kt new file mode 100644 index 00000000..310cd598 --- /dev/null +++ b/ModularFightSystem/FightSystem/src/state/FightState.kt @@ -0,0 +1,54 @@ +/* + * 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 . + */ + +package de.steamwar.fightsystem.state + +import de.steamwar.modularfightsystem.complement +import de.steamwar.modularfightsystem.enumSetAll +import de.steamwar.modularfightsystem.enumSetOf +import de.steamwar.modularfightsystem.state.FightStateMachine + +enum class FightState { + PRE_LEADER_SETUP, + PRE_SCHEM_SETUP, + POST_SCHEM_SETUP, + PRE_RUNNING, + RUNNING, + SPECTATE; + + companion object : FightStateMachine(PRE_LEADER_SETUP) { + val All = enumSetAll() + + val PreLeaderSetup = enumSetOf(PRE_LEADER_SETUP) + val PreSchemSetup = enumSetOf(PRE_SCHEM_SETUP) + val PostSchemSetup = enumSetOf(POST_SCHEM_SETUP) + val PreRunning = enumSetOf(PRE_RUNNING) + val Running = enumSetOf(RUNNING) + val Spectate = enumSetOf(SPECTATE) + + val Setup = enumSetOf(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP) + val Ingame = enumSetOf(PRE_RUNNING, RUNNING) + val TeamFix = enumSetOf(PRE_RUNNING, RUNNING, SPECTATE) + val Schem = enumSetOf(PRE_LEADER_SETUP, PRE_SCHEM_SETUP).complement() + val Recording = enumSetOf(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, SPECTATE).complement() + val AntiRunning = enumSetOf(RUNNING).complement() + val AntiIngame = enumSetOf(PRE_RUNNING, RUNNING).complement() + val AntiSpectate = enumSetOf(SPECTATE).complement() + } +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/build.gradle.kts b/ModularFightSystem/GameCore/build.gradle.kts new file mode 100644 index 00000000..b760f099 --- /dev/null +++ b/ModularFightSystem/GameCore/build.gradle.kts @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +plugins { + steamwar.kotlin +} + +java { + targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 +} + +dependencies { + compileOnly(libs.paperapi21) + compileOnly(libs.nms21) + compileOnly(project(":SpigotCore", "default")) +} diff --git a/ModularFightSystem/GameCore/src/ArenaMode.kt b/ModularFightSystem/GameCore/src/ArenaMode.kt new file mode 100644 index 00000000..8360bcfc --- /dev/null +++ b/ModularFightSystem/GameCore/src/ArenaMode.kt @@ -0,0 +1,54 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem + +enum class ArenaMode { + NORMAL, + EVENT, + TEST, + CHECK, + PREPARE, + REPLAY; + + companion object { + val All = enumSetAll() + + val Normal = enumSetOf(NORMAL) + val Event = enumSetOf(EVENT) + val Test = enumSetOf(TEST) + val Check = enumSetOf(CHECK) + val Prepare = enumSetOf(PREPARE) + val Replay = enumSetOf(REPLAY) + + val AntiReplay = Replay.complement() + val AntiTest = Test.complement() + val AntiEvent = Event.complement() + val AntiTestCheckPrepare = enumSetOf(TEST, CHECK, PREPARE).complement() + val AntiPrepare = Prepare.complement() + val VariableTeams = enumSetOf(EVENT, REPLAY, CHECK).complement() + val ManualTeams = enumSetOf(EVENT, REPLAY).complement() + val RankedEvent = enumSetOf(EVENT, REPLAY) + val Restartable = enumSetOf(NORMAL, TEST) + val NotRestartable = enumSetOf(EVENT, REPLAY) + val SoloLeader = enumSetOf(TEST, CHECK, PREPARE) + val NotOnBau = enumSetOf(TEST, CHECK, PREPARE, REPLAY).complement() + val SeriousFight = enumSetOf(TEST, CHECK, REPLAY).complement() + } +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/Config.kt b/ModularFightSystem/GameCore/src/Config.kt new file mode 100644 index 00000000..801b2cd9 --- /dev/null +++ b/ModularFightSystem/GameCore/src/Config.kt @@ -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 . + */ + +package de.steamwar.modularfightsystem + +import de.steamwar.message.Message +import org.bukkit.plugin.Plugin + +object Config { + lateinit var plugin: Plugin + + val mode = ArenaMode.TEST +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/Utils.kt b/ModularFightSystem/GameCore/src/Utils.kt new file mode 100644 index 00000000..5525c60a --- /dev/null +++ b/ModularFightSystem/GameCore/src/Utils.kt @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem + +import java.util.Collections +import java.util.EnumSet + +typealias KEnumSet = Set + +inline fun enumSetOf(): KEnumSet where T : Enum = Collections.unmodifiableSet(EnumSet.noneOf(T::class.java)) + +inline fun enumSetAll(): KEnumSet where T : Enum = Collections.unmodifiableSet(EnumSet.allOf(T::class.java)) + +inline fun enumSetOf(vararg elements: T): KEnumSet where T : Enum = Collections.unmodifiableSet(EnumSet.copyOf(elements.toSet())) + +fun KEnumSet.complement(): KEnumSet where T: Enum = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.copyOf(this))) diff --git a/ModularFightSystem/GameCore/src/countdown/Countdown.kt b/ModularFightSystem/GameCore/src/countdown/Countdown.kt new file mode 100644 index 00000000..dacd77df --- /dev/null +++ b/ModularFightSystem/GameCore/src/countdown/Countdown.kt @@ -0,0 +1,96 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.countdown + +import de.steamwar.modularfightsystem.Config +import net.kyori.adventure.text.Component +import net.kyori.adventure.text.ComponentLike +import org.bukkit.Bukkit +import org.bukkit.Sound +import org.bukkit.entity.Player +import org.bukkit.scheduler.BukkitTask + +abstract class Countdown(val totalTime: Int, val appendix: ComponentLike, val sound: Sound?, val level: Boolean) { + var time = totalTime + private var task: BukkitTask? = null + + abstract fun countdownFinished() + + fun enable() { + time = totalTime + task = Bukkit.getScheduler().runTaskTimer(Config.plugin, this::count, 0, 20) + countdowns.add(this) + show() + } + + fun disable() { + if (task != null) { + task!!.cancel() + countdowns.remove(this) + task = null + } + } + + private fun show() { + when(time) { + 900, 600, 300, 180, 120 -> broadcast("COUNTDOWN_MINUTES", 60) + 60, 30, 20, 15, 10, 5, 4, 3, 2 -> broadcast("COUNTDOWN_SECONDS", 1) + 1 -> broadcast("COUNTDOWN_SECOND", 1) + 0 -> { + playSound() + + disable() + countdownFinished() + } + } + + if (level) { + Bukkit.getOnlinePlayers().forEach { it.level = time } + } + } + + private fun count() { + time-- + show() + } + + protected fun broadcast(message: String, divisor: Int) { + playSound() + + Bukkit.getOnlinePlayers().forEach { sendCountdownMessage(it, message, totalTime / divisor, appendix) } + } + + fun playSound() = sound?.let { Bukkit.getOnlinePlayers().forEach { it.playSound(it.location, sound, 100f, 1f) } } + + fun sendCountdownMessage(p: Player, message: String, displayTime: Int, appendix: ComponentLike) = + p.sendMessage(Component.translatable(message, Component.text(displayTime), appendix)) + + companion object { + private val countdowns = mutableListOf() + + fun skip() { + if (countdowns.isEmpty()) return + + val smallestTime = countdowns.minOf { it.time } + + countdowns.forEach { it.also { it.time -= smallestTime }.show() } + } + } +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/fight/FightPlayer.kt b/ModularFightSystem/GameCore/src/fight/FightPlayer.kt new file mode 100644 index 00000000..720d6609 --- /dev/null +++ b/ModularFightSystem/GameCore/src/fight/FightPlayer.kt @@ -0,0 +1,23 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.fight + +class FightPlayer { +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/fight/FightTeam.kt b/ModularFightSystem/GameCore/src/fight/FightTeam.kt new file mode 100644 index 00000000..b8b73453 --- /dev/null +++ b/ModularFightSystem/GameCore/src/fight/FightTeam.kt @@ -0,0 +1,22 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.fight + +class FightTeam() diff --git a/ModularFightSystem/GameCore/src/state/FightStateMachine.kt b/ModularFightSystem/GameCore/src/state/FightStateMachine.kt new file mode 100644 index 00000000..77bfe3fc --- /dev/null +++ b/ModularFightSystem/GameCore/src/state/FightStateMachine.kt @@ -0,0 +1,46 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.state + +abstract class FightStateMachine>(initialState: T) { + init { + instance = this + } + + var state: T = initialState + set(value) { + field = value + + stateDependents.forEach { dependent -> dependent.enabled = value in dependent.states } + } + + private val stateDependents = mutableListOf() + + fun register(stateDependent: StateDependent) { + if (stateDependent.states.isEmpty() or !stateDependent.active) return + stateDependents.add(stateDependent) + stateDependent.enabled = state in stateDependent.states + } + + companion object { + lateinit var instance: FightStateMachine<*> + private set + } +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/state/OneShotStateDependent.kt b/ModularFightSystem/GameCore/src/state/OneShotStateDependent.kt new file mode 100644 index 00000000..683942c5 --- /dev/null +++ b/ModularFightSystem/GameCore/src/state/OneShotStateDependent.kt @@ -0,0 +1,35 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.state + +import de.steamwar.modularfightsystem.ArenaMode +import de.steamwar.modularfightsystem.Config +import de.steamwar.modularfightsystem.KEnumSet + +class OneShotStateDependent(active: Boolean, states: KEnumSet<*>, val runnable: () -> Unit): StateDependent(active, states) { + constructor(modes: KEnumSet, states: KEnumSet<*>, runnable: () -> Unit) : this(Config.mode in modes, states, runnable) + + init { + register() + } + + override fun enable() = runnable() + override fun disable() = Unit +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/state/StateDependent.kt b/ModularFightSystem/GameCore/src/state/StateDependent.kt new file mode 100644 index 00000000..31400f48 --- /dev/null +++ b/ModularFightSystem/GameCore/src/state/StateDependent.kt @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.state + +import de.steamwar.modularfightsystem.ArenaMode +import de.steamwar.modularfightsystem.Config +import de.steamwar.modularfightsystem.KEnumSet + +abstract class StateDependent(val active: Boolean, val states: KEnumSet<*>) { + constructor(modes: KEnumSet, states: KEnumSet<*>) : this(Config.mode in modes, states) + + var enabled = false + set(value) { + if (value != field) if (value) enable() else disable() + field = value + } + + fun register() { + FightStateMachine.instance.register(this) + } + + abstract fun enable() + abstract fun disable() +} diff --git a/ModularFightSystem/GameCore/src/state/StateDependentCommand.kt b/ModularFightSystem/GameCore/src/state/StateDependentCommand.kt new file mode 100644 index 00000000..71090b51 --- /dev/null +++ b/ModularFightSystem/GameCore/src/state/StateDependentCommand.kt @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.state + +import de.steamwar.command.SWCommand +import de.steamwar.modularfightsystem.ArenaMode +import de.steamwar.modularfightsystem.KEnumSet + +class StateDependentCommand(mode: KEnumSet, states: KEnumSet<*>, val command: SWCommand): StateDependent(mode, states) { + init { + register() + } + + override fun enable() = command.register() + override fun disable() = command.unregister() +} \ No newline at end of file diff --git a/ModularFightSystem/GameCore/src/state/StateDependentTask.kt b/ModularFightSystem/GameCore/src/state/StateDependentTask.kt new file mode 100644 index 00000000..4bc96e59 --- /dev/null +++ b/ModularFightSystem/GameCore/src/state/StateDependentTask.kt @@ -0,0 +1,45 @@ +/* + * 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 . + */ + +package de.steamwar.modularfightsystem.state + +import de.steamwar.modularfightsystem.ArenaMode +import de.steamwar.modularfightsystem.Config +import de.steamwar.modularfightsystem.KEnumSet +import org.bukkit.Bukkit +import org.bukkit.scheduler.BukkitTask + +class StateDependentTask(active: Boolean, states: KEnumSet<*>, val runnable: () -> Unit, val delay: Long, val period: Long): StateDependent(active, states) { + constructor(modes: KEnumSet, states: KEnumSet<*>, runnable: () -> Unit, delay: Long, period: Long) : this( + Config.mode in modes, states, runnable, delay, period) + + init { + register() + } + + var task: BukkitTask? = null + + override fun enable() { + task = Bukkit.getScheduler().runTaskTimer(Config.plugin, runnable, delay, period) + } + + override fun disable() { + task?.cancel() + } +} \ No newline at end of file diff --git a/ModularFightSystem/build.gradle.kts b/ModularFightSystem/build.gradle.kts new file mode 100644 index 00000000..af0059dd --- /dev/null +++ b/ModularFightSystem/build.gradle.kts @@ -0,0 +1,22 @@ +/* + * 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 . + */ + +plugins { + `java-library` +} \ No newline at end of file diff --git a/SpigotCore/SpigotCore_14/build.gradle.kts b/SpigotCore/SpigotCore_14/build.gradle.kts index e4746ba5..c94f981a 100644 --- a/SpigotCore/SpigotCore_14/build.gradle.kts +++ b/SpigotCore/SpigotCore_14/build.gradle.kts @@ -18,7 +18,7 @@ */ plugins { - steamwar.java + steamwar.kotlin } dependencies { @@ -29,4 +29,5 @@ dependencies { compileOnly(libs.nms14) compileOnly(libs.worldedit15) + compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.2.21") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 5f364d5b..b29b83d2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -255,3 +255,9 @@ include( include("TNTLeague") include("WebsiteBackend") + +include( + "ModularFightSystem", + "ModularFightSystem:GameCore", + "ModularFightSystem:FightSystem" +) \ No newline at end of file