Compare commits

..
Author SHA1 Message Date
YoyoNow 397b10c319 Merge pull request 'Velocity core /event command' (#465) from VelocityCore/EventCommand into main
Deploy / Build (push) Successful in 2m12s
Deploy / Deploy (push) Successful in 10s
Reviewed-on: #465
Reviewed-by: YoyoNow <4+yoyonow@noreply.localhost>
2026-08-14 07:53:43 +02:00
YoyoNow 32569f19d9 Closes: #468
Deploy / Build (push) Successful in 2m15s
Deploy / Deploy (push) Successful in 11s
2026-08-13 10:09:13 +02:00
YoyoNow f19e4158e7 Fix Check
Deploy / Build (push) Successful in 2m19s
Deploy / Deploy (push) Successful in 13s
2026-08-13 10:01:55 +02:00
YoyoNow 6c46b5b2a2 Fix Check
Deploy / Build (push) Successful in 2m20s
Deploy / Deploy (push) Successful in 11s
2026-08-13 09:51:56 +02:00
YoyoNow 58516448d9 Merge pull request 'Add deletion of PlayerData on /bau delmember' (#454) from VelocityCore/DeleteMemberOfBauDeletingPlayerData into main
Deploy / Build (push) Successful in 2m17s
Deploy / Deploy (push) Successful in 11s
Reviewed-on: #454
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2026-08-13 09:50:14 +02:00
YoyoNow 683236bb59 Fix TexturePackSystem for newer versions
Deploy / Build (push) Successful in 2m11s
Deploy / Deploy (push) Successful in 10s
2026-08-13 09:39:42 +02:00
YoyoNow 8dc101639d Add alias of /tick rate to /tick rate 20
Deploy / Build (push) Successful in 2m23s
Deploy / Deploy (push) Successful in 15s
2026-08-11 21:48:28 +02:00
YoyoNow 792620804a Improve TPSSystem
Deploy / Build (push) Successful in 2m26s
Deploy / Deploy (push) Successful in 11s
2026-08-11 21:46:38 +02:00
YoyoNow 4aa7c99a6e Fix Check and CheckCommand permission
Deploy / Build (push) Successful in 3m30s
Deploy / Deploy (push) Successful in 11s
2026-08-11 21:05:36 +02:00
Sakziea cce18124f2 Remove unused translation
Pull Request Build / Build (pull_request) Successful in 3m33s
Backport CommonCore / Create CommonCore backport PRs (pull_request) Failing after 8s
2026-08-05 20:30:36 +02:00
Sakziea 18ad0ad90c Add Clickevents to EventPage 2026-08-05 20:30:28 +02:00
Sakziea a58de898bb Add Clickevents to EventPage 2026-08-05 20:30:25 +02:00
Sakziea 507b7c2569 Add event showtable 2026-08-05 20:30:20 +02:00
Sakziea a18098b8f4 Fix Pull request comments 2026-08-05 20:30:15 +02:00
Sakziea 97773f292d Remove unused import 2026-08-05 20:30:09 +02:00
Sakziea 5fdfc03587 Fix /event [Team] move to /event team [Team] 2026-08-05 20:30:00 +02:00
Sakziea 493e66cc98 Add current event uses eventpage 2026-08-05 20:29:37 +02:00
Sakziea 2be3a136ae Add funktion to show next events and formatet the fights in pages 2026-08-05 20:29:28 +02:00
Sakziea c62a566447 Fix pull Request comment 2026-08-05 20:29:18 +02:00
Sakziea 0684765a76 Remove unused imports 2026-08-05 20:29:09 +02:00
Sakziea c40f29c3c1 Add Wind charge config 2026-08-05 20:28:53 +02:00
Sakziea 72dc4eee9e Fix Wind charges cross middle and interact with Blocks 2026-08-05 20:28:24 +02:00
Sakziea c7a949322e Fix Windcharge remove Water 2026-08-05 20:27:39 +02:00
Chaoscaot 9d5b7893f1 Merge pull request 'Replace Custom Observer with kotlinx StateFlows' (#444) from swui/flows into main
Deploy / Build (push) Successful in 2m47s
Deploy / Deploy (push) Successful in 11s
Reviewed-on: #444
Reviewed-by: YoyoNow <4+yoyonow@noreply.localhost>
2026-07-26 10:22:42 +02:00
Chaoscaot ae898e14c2 Merge branch 'main' into swui/flows
Pull Request Build / Build (pull_request) Successful in 1m56s
Backport CommonCore / Create CommonCore backport PRs (pull_request) Successful in 8s
2026-07-26 10:20:35 +02:00
Chaoscaot 726f73cc45 Merge branch 'main' into VelocityCore/DeleteMemberOfBauDeletingPlayerData
Pull Request Build / Build (pull_request) Successful in 1m32s
Backport CommonCore / Create CommonCore backport PRs (pull_request) Successful in 9s
2026-07-26 03:04:45 +02:00
YoyoNow 64e627514d Add deletion of PlayerData on /bau delmember
Pull Request Build / Build (pull_request) Successful in 1m29s
2026-07-17 09:47:40 +02:00
Chaoscaot 3a247de43d Replace Custom Observer with kotlinx StateFlows
Pull Request Build / Build (pull_request) Successful in 1m50s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-07-06 01:13:05 +02:00
153 changed files with 1539 additions and 2155 deletions
-151
View File
@@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LanguageInjectionConfiguration">
<injection language="SQL" injector-id="java">
<display-name>AsyncQueryRunner (org.apache.commons.dbutils)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batch").withParameterCount(2).definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("insertBatch").withParameterCount(3).definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "insert").withParameters("java.lang.String", "org.apache.commons.dbutils.ResultSetHandler").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "insert").withParameters("java.lang.String", "org.apache.commons.dbutils.ResultSetHandler", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.lang.Object").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("batch").withParameterCount(3).definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("insertBatch").withParameterCount(4).definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("query", "insert").withParameters("java.sql.Connection", "java.lang.String", "org.apache.commons.dbutils.ResultSetHandler").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("query", "insert").withParameters("java.sql.Connection", "java.lang.String", "org.apache.commons.dbutils.ResultSetHandler", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update").withParameters("java.sql.Connection", "java.lang.String").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update").withParameters("java.sql.Connection", "java.lang.String", "java.lang.Object").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update").withParameters("java.sql.Connection", "java.lang.String", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.AsyncQueryRunner"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Jodd (jodd.db)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameterCount(1).definedInClass("jodd.db.DbQuery"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("DbQuery").withParameterCount(2).definedInClass("jodd.db.DbQuery"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("query").withParameterCount(2).definedInClass("jodd.db.DbQuery"))]]></place>
<place><![CDATA[psiParameter().ofMethod(2, psiMethod().withName("DbQuery").withParameterCount(3).definedInClass("jodd.db.DbQuery"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>MyBatis @Select/@Delete/@Insert/@Update</display-name>
<single-file value="true" />
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.apache.ibatis.annotations.Delete")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.apache.ibatis.annotations.Insert")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.apache.ibatis.annotations.Select")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.apache.ibatis.annotations.Update")]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>QueryRunner (org.apache.commons.dbutils)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batch").withParameterCount(2).definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("insertBatch").withParameterCount(3).definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "insert").withParameters("java.lang.String", "org.apache.commons.dbutils.ResultSetHandler").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "insert", "execute").withParameters("java.lang.String", "org.apache.commons.dbutils.ResultSetHandler", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.lang.Object").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update", "execute").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("batch").withParameterCount(3).definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("insertBatch").withParameterCount(4).definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("query", "insert").withParameters("java.sql.Connection", "java.lang.String", "org.apache.commons.dbutils.ResultSetHandler", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("query", "insert", "execute").withParameters("java.sql.Connection", "java.lang.String", "org.apache.commons.dbutils.ResultSetHandler").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update").withParameters("java.sql.Connection", "java.lang.String").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update").withParameters("java.sql.Connection", "java.lang.String", "java.lang.Object").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("update", "execute").withParameters("java.sql.Connection", "java.lang.String", "java.lang.Object...").definedInClass("org.apache.commons.dbutils.QueryRunner"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>R2DBC (io.r2dbc)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("add").definedInClass("io.r2dbc.spi.Batch"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("createStatement").definedInClass("io.r2dbc.spi.Connection"))]]></place>
</injection>
<injection language="PostgreSQL" injector-id="java">
<display-name>Reactiverse Postgres Client (io.reactiverse)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.reactiverse.pgclient.PgConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.reactiverse.pgclient.PgTransaction"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.reactiverse.reactivex.pgclient.PgClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.reactiverse.reactivex.pgclient.PgConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.reactiverse.reactivex.pgclient.PgPool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.reactiverse.reactivex.pgclient.PgTransaction"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.reactiverse.axle.pgclient.PgClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.reactiverse.pgclient.PgClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.reactiverse.pgclient.PgPool"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SmallRye Axle SqlClient (io.vertx.axle.sqlclient)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.vertx.axle.sqlclient.Pool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.vertx.axle.sqlclient.SqlClient"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SmallRye Mutiny SqlClient (io.vertx.mutiny.sqlclient)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.vertx.mutiny.sqlclient.Pool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "preparedQuery", "preparedBatch").definedInClass("io.vertx.mutiny.sqlclient.SqlClient"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SmallRye Mutiny SqlConnection (io.vertx.mutiny.sqlclient)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("prepare", "prepareAndAwait").definedInClass("io.vertx.mutiny.db2client.DB2Connection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("prepare", "prepareAndAwait").definedInClass("io.vertx.mutiny.mssqlclient.MSSQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("prepare", "prepareAndAwait").definedInClass("io.vertx.mutiny.mysqlclient.MySQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("prepare", "prepareAndAwait").definedInClass("io.vertx.mutiny.pgclient.PgConnection"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Vert.x SQL Extensions (io.vertx.ext.sql)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams").definedInClass("io.vertx.ext.sql.SQLClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams").definedInClass("io.vertx.ext.sql.SQLOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams", "execute", "batchWithParams", "batchCallableWithParams").definedInClass("io.vertx.ext.sql.SQLConnection"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Vert.x SQL Reactive Extensions (io.vertx.reactivex.ext.sql)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams").definedInClass("io.vertx.reactivex.ext.sql.SQLOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams", "execute", "batchWithParams", "batchCallableWithParams", "rxQuerySingle", "rxQuerySingleWithParams", "rxQuery", "rxQueryWithParams", "rxQueryStream", "rxQueryStreamWithParams", "rxUpdate", "rxUpdateWithParams", "rxCall", "rxCallWithParams", "rxExecute", "rxBatchWithParams", "rxBatchCallableWithParams").definedInClass("io.vertx.reactivex.ext.sql.SQLClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "queryWithParams", "queryStream", "queryStreamWithParams", "querySingle", "querySingleWithParams", "update", "updateWithParams", "call", "callWithParams", "execute", "batchWithParams", "batchCallableWithParams", "rxQuerySingle", "rxQuerySingleWithParams", "rxQuery", "rxQueryWithParams", "rxQueryStream", "rxQueryStreamWithParams", "rxUpdate", "rxUpdateWithParams", "rxCall", "rxCallWithParams", "rxExecute", "rxBatchWithParams", "rxBatchCallableWithParams").definedInClass("io.vertx.reactivex.ext.sql.SQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("querySingle", "rxQuerySingle", "querySingleWithParams", "rxQuerySingleWithParams").definedInClass("io.vertx.reactivex.ext.asyncsql.AsyncSQLClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("querySingle", "rxQuerySingle", "querySingleWithParams", "rxQuerySingleWithParams").definedInClass("io.vertx.reactivex.ext.asyncsql.MySQLClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("querySingle", "rxQuerySingle", "querySingleWithParams", "rxQuerySingleWithParams").definedInClass("io.vertx.reactivex.ext.asyncsql.PostgreSQLClient"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Vert.x SqlClient (io.vertx.sqlclient)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.mssqlclient.MSSQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.mysqlclient.MySQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.pgclient.PgConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.sqlclient.Pool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.sqlclient.SqlClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.sqlclient.SqlConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch").definedInClass("io.vertx.sqlclient.Transaction"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Vert.x SqlClient RxJava2 (io.vertx.reactivex.sqlclient)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.mysqlclient.MySQLConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.pgclient.PgConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.sqlclient.SqlConnection"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPrepare", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.sqlclient.Transaction"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.mysqlclient.MySQLPool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.pgclient.PgPool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.sqlclient.Pool"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "prepare", "preparedQuery", "preparedBatch", "rxQuery", "rxPreparedQuery", "rxPreparedBatch").definedInClass("io.vertx.reactivex.sqlclient.SqlClient"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>jOOQ (org.jooq.DSLContext)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batch").withParameters("java.lang.String", "java.lang.Object[]...").definedInClass("org.jooq.DSLContext"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "fetch", "fetchLazy", "fetchAsync", "fetchStream", "fetchMany", "fetchOne", "fetchSingle", "fetchOptional", "fetchValue", "fetchOptionalValue", "fetchValues", "execute", "resultQuery").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.jooq.DSLContext"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query", "fetch", "fetchLazy", "fetchAsync", "fetchStream", "fetchMany", "fetchOne", "fetchSingle", "fetchOptional", "fetchValue", "fetchOptionalValue", "fetchValues", "execute", "resultQuery", "batch").withParameters("java.lang.String").definedInClass("org.jooq.DSLContext"))]]></place>
<place><![CDATA[psiParameter().ofMethod(psiMethod().withName("batch").withParameters("java.lang.String...").definedInClass("org.jooq.DSLContext"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>rxjava2-jdbc (org.davidmoten.rx.jdbc)</display-name>
<single-file value="true" />
<place><![CDATA[psiMethod().withName("value").definedInClass("org.davidmoten.rx.jdbc.annotations.Query")]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("call", "select", "update").definedInClass("org.davidmoten.rx.jdbc.Database"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("call", "select", "update").definedInClass("org.davidmoten.rx.jdbc.TransactedBuilder"))]]></place>
</injection>
</component>
</project>
@@ -290,7 +290,7 @@ public class KillcheckerVisualizer {
}
rEntities.get(point).die();
}
RBlockDisplay entity = new RBlockDisplay(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5));
RBlockDisplay entity = new RBlockDisplay(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0, 0, 0));
entity.setBlock(MATERIALS[Math.min(count - 1, MATERIALS.length) - 1].createBlockData());
rEntities.put(point, entity);
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
@@ -165,6 +165,7 @@ public class TPSSystem implements Listener {
}
@Register(value = "default", description = "TPSLIMIT_DEFAULT_HELP")
@Register(value = "rate")
public void reset(@Validator Player player) {
TickManager.impl.setTickRate(20.0F);
sendTickRateChange();
@@ -187,15 +188,18 @@ public class TPSSystem implements Listener {
}
@Register(value = {"rate", "0"}, description = "TICK_FREEZE_HELP")
@Register(value = "freeze", description = "TICK_FREEZE_HELP_2")
public void freeze(@Validator Player player) {
public void rate(@Validator Player player) {
TickManager.impl.setFreeze(true);
sendTickRateChange();
}
@Register(value = "unfreeze", description = "TICK_UNFREEZE_HELP")
public void unfreeze(@Validator Player player) {
TickManager.impl.setTickRate(20.0F);
@Register(value = "freeze", description = "TICK_FREEZE_HELP_2")
public void freezeToggle(@Validator Player player) {
if (TickManager.impl.isFrozen()) {
TickManager.impl.setTickRate(20.0F);
} else {
TickManager.impl.setFreeze(true);
}
sendTickRateChange();
}
}
@@ -29,7 +29,6 @@ java {
dependencies {
compileOnly(libs.classindex)
annotationProcessor(libs.classindex)
compileOnly(project(":GameCore", "default"))
compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.netty)
@@ -0,0 +1,56 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
public enum ArenaMode {
NORMAL,
EVENT,
TEST,
CHECK,
PREPARE,
REPLAY;
public static final Set<ArenaMode> All = Collections.unmodifiableSet(EnumSet.allOf(ArenaMode.class));
public static final Set<ArenaMode> Normal = Collections.unmodifiableSet(EnumSet.of(NORMAL));
public static final Set<ArenaMode> Check = Collections.unmodifiableSet(EnumSet.of(CHECK));
public static final Set<ArenaMode> Event = Collections.unmodifiableSet(EnumSet.of(EVENT));
public static final Set<ArenaMode> Test = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK));
public static final Set<ArenaMode> Prepare = Collections.unmodifiableSet(EnumSet.of(PREPARE));
public static final Set<ArenaMode> Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY, TEST));
public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY)));
public static final Set<ArenaMode> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK)));
public static final Set<ArenaMode> AntiEvent = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT)));
public static final Set<ArenaMode> AntiTestCheckPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE)));
public static final Set<ArenaMode> AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE)));
public static final Set<ArenaMode> VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT, REPLAY, CHECK)));
public static final Set<ArenaMode> ManualTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT, REPLAY)));
public static final Set<ArenaMode> RankedEvent = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY));
public static final Set<ArenaMode> Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, TEST));
public static final Set<ArenaMode> NotRestartable = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY));
public static final Set<ArenaMode> SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE));
public static final Set<ArenaMode> NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE, REPLAY)));
public static final Set<ArenaMode> SeriousFight = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, REPLAY)));
}
@@ -22,7 +22,6 @@ package de.steamwar.fightsystem;
import de.steamwar.data.GameModeConfigUtils;
import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.sql.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -36,6 +35,7 @@ import org.bukkit.util.Vector;
import java.io.File;
import java.util.Collections;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
public class Config {
@@ -75,6 +75,8 @@ public class Config {
public static final String TeamBlueName;
public static final String TeamRedColor;
public static final String TeamBlueColor;
public static final UUID BlueLeader;
public static final UUID RedLeader;
//event parameter
public static final EventFight EventKampf;
@@ -85,12 +87,23 @@ public class Config {
public static final int MaximumTeamMembers;
public static final boolean LiveReplay;
//check parameter
public static final int CheckSchemID;
public static final int PrepareSchemID;
public static final ArenaMode mode;
//replay system parameter
public static final String spectateIP = "127.0.0.1";
public static final int SpectatePort;
public static final int ReplayID;
static {
String configFile = GameConfig.ConfigFile;
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0"));
ReplayID = Integer.parseInt(System.getProperty("replay", "0"));
String configFile = System.getProperty("config", "config.yml");
if (!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
FightSystem.getPlugin().saveDefaultConfig();
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
@@ -196,7 +209,7 @@ public class Config {
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMinY() + GameModeConfig.Schematic.Inset.bottom, BluePasteRegion.getMinZ() + GameModeConfig.Schematic.Inset.z, BluePasteRegion.getMaxX() - GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMaxY() - GameModeConfig.Schematic.Inset.top, BluePasteRegion.getMaxZ() - GameModeConfig.Schematic.Inset.z);
int eventKampfID = GameConfig.EventKampfID;
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
if (eventKampfID >= 1) {
EventKampf = EventFight.byId(eventKampfID);
if (EventKampf == null) {
@@ -248,8 +261,43 @@ public class Config {
Referees = Collections.emptySet();
MaximumTeamMembers = Integer.MAX_VALUE;
LiveReplay = false;
SpectatePort = -GameConfig.ReplayID;
SpectatePort = -ReplayID;
}
String blueLeader = System.getProperty("blueLeader", null);
String redLeader = System.getProperty("redLeader", null);
if (blueLeader != null) {
BlueLeader = UUID.fromString(blueLeader);
} else {
BlueLeader = null;
}
if (redLeader != null) {
RedLeader = UUID.fromString(redLeader);
} else {
RedLeader = null;
}
if (CheckSchemID != 0) {
mode = ArenaMode.CHECK;
} else if (PrepareSchemID != 0) {
mode = ArenaMode.PREPARE;
} else if (eventKampfID >= 1) {
mode = ArenaMode.EVENT;
} else if (eventKampfID == -1) {
mode = ArenaMode.TEST;
} else if (ReplayID != 0) {
mode = ArenaMode.REPLAY;
} else {
mode = ArenaMode.NORMAL;
}
}
public static boolean test() {
return ArenaMode.Test.contains(mode);
}
public static boolean replayserver() {
return ReplayID < 0;
}
public static boolean blueNegZ() {
@@ -36,8 +36,6 @@ import de.steamwar.fightsystem.utils.FightUI;
import de.steamwar.fightsystem.utils.HullHider;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.utils.TechHiderWrapper;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.linkage.AbstractLinker;
import de.steamwar.linkage.SpigotLinker;
import de.steamwar.message.Message;
@@ -77,7 +75,7 @@ public class FightSystem extends JavaPlugin {
}
if (Config.SpectatePort != 0) {
Core.setServerName("Spectate");
} else if (GameConfig.ReplayID != 0) {
} else if (Config.ReplayID != 0) {
Core.setServerName("Replay");
}
@@ -111,7 +109,7 @@ public class FightSystem extends JavaPlugin {
});
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(GameConfig.mode));
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
hullHider = new HullHider();
techHider = new TechHiderWrapper(hullHider);
@@ -120,10 +118,10 @@ public class FightSystem extends JavaPlugin {
FileSource.startReplay();
if (GameConfig.mode == ArenaMode.EVENT) {
if (Config.mode == ArenaMode.EVENT) {
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
} else if (GameConfig.mode == ArenaMode.CHECK) {
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
} else if (Config.mode == ArenaMode.CHECK) {
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
Fight.getBlueTeam().setSchem(checkSchematicNode);
if (checkSchematicNode.isPrepared()) {
@@ -131,8 +129,8 @@ public class FightSystem extends JavaPlugin {
}
new TechareaCommand();
} else if (GameConfig.mode == ArenaMode.PREPARE) {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(GameConfig.PrepareSchemID));
} else if (Config.mode == ArenaMode.PREPARE) {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
}
Config.world.setGameRule(GameRule.LOCATOR_BAR, false);
@@ -20,7 +20,7 @@
package de.steamwar.fightsystem.ai;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -19,8 +19,8 @@
package de.steamwar.fightsystem.ai;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.FightTeam;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class AIManager {
private static final List<AIManager> AIs = Arrays.asList(
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(GameConfig.mode))
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(Config.mode))
);
public static List<AIManager> availableAIs() {
@@ -20,7 +20,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.core.Core;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Kit;
import de.steamwar.fightsystem.states.FightState;
@@ -19,8 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.ai.AIManager;
@@ -57,7 +56,7 @@ public class GUI {
inv.setItem(pos, ColorConverter.chat2dye(team.getColor()), msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
p.closeInventory();
if (ArenaMode.ManualTeams.contains(GameConfig.mode) && team.canbeLeader(p)) {
if (ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p)) {
team.addMember(p);
} else {
JoinRequest.forPlayer(p, team);
@@ -199,7 +198,7 @@ public class GUI {
}
public static void preSchemDialog(Player p) {
if (!GameConfig.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
if (!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
return;
}
@@ -210,7 +209,7 @@ public class GUI {
for (int i = 0; i < Config.GameModeConfig.Schematic.SubTypes.size(); i++) {
setupSchemTypeRow(p, inv, Config.GameModeConfig.Schematic.SubTypes.get(i), i + 1);
}
if (!GameConfig.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
if (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameModeConfig.GameName, (Integer) null);
if (node != null) {
inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> {
@@ -234,14 +233,14 @@ public class GUI {
return;
}
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(GameConfig.mode) && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(Config.mode) && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
inv.setItem(row * 9 + 4, Material.ANVIL, msg.parse("SCHEM_UNCHECKED", p, type.name()), (ClickType click) -> {
p.closeInventory();
schemDialog(p, type, false, true);
});
}
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !GameConfig.test()) {
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !Config.test()) {
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click) -> {
});
return;
@@ -254,7 +253,7 @@ public class GUI {
}
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked) {
SchematicSelector selector = new SchematicSelector(p, GameConfig.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
schemSelect(p, node);
});
selector.setPublicMode(publicSchems ? SchematicSelector.PublicMode.PUBLIC_ONLY : SchematicSelector.PublicMode.PRIVATE_ONLY);
@@ -264,7 +263,7 @@ public class GUI {
private static void schemSelect(Player p, SchematicNode node) {
FightTeam fightTeam = Fight.getPlayerTeam(p);
if (fightTeam == null) return;
if (GameConfig.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
if (Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
fightTeam.pasteSchem(node);
}
p.closeInventory();
@@ -22,7 +22,6 @@ package de.steamwar.fightsystem.commands;
import com.google.common.collect.ImmutableList;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
@@ -66,7 +65,7 @@ public class GamemodeCommand extends BukkitCommand {
Player p = (Player) sender;
if (!(GameConfig.test() || Config.isReferee(p))) {
if (!(Config.test() || Config.isReferee(p))) {
FightSystem.getMessage().sendPrefixless("GAMEMODE_NOT_ALLOWED", p, ChatMessageType.ACTION_BAR);
return false;
}
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.linkage.Linked;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.linkage.Linked;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.linkage.Linked;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
@@ -19,8 +19,8 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.record.PacketProcessor;
import de.steamwar.fightsystem.states.FightState;
@@ -35,7 +35,7 @@ import org.bukkit.entity.Player;
public class SkipCommand implements CommandExecutor {
public SkipCommand() {
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(GameConfig.mode) ? FightState.All : FightState.TeamFix, "skip", this);
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(Config.mode) ? FightState.All : FightState.TeamFix, "skip", this);
}
@Override
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.linkage.Linked;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
@@ -17,7 +17,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
@@ -20,8 +20,7 @@
package de.steamwar.fightsystem.commands;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -50,7 +49,7 @@ public class TechhiderbugCommand implements CommandExecutor {
StringWriter writer = new StringWriter();
try {
writer.append("ArenaMode: ").append(GameConfig.mode.name()).append('\n');
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
writer.append("FightState: ").append(FightState.getFightState().name()).append('\n');
writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n');
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.states.FightState;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -0,0 +1,151 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.countdown;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.utils.FightUI;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList;
import java.util.List;
public abstract class Countdown {
private static final List<Countdown> currentCountdowns = new ArrayList<>();
protected final Message appendix;
private final int totalTime;
protected final Sound sound;
private final boolean level;
protected int time;
private BukkitTask task = null;
public abstract void countdownFinished();
protected Countdown(int time, Message appendix, SWSound sound, boolean level) {
this.totalTime = time;
this.time = time;
this.appendix = appendix;
this.sound = sound != null ? sound.getSound() : null;
this.level = level;
}
public void enable() {
time = totalTime;
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
currentCountdowns.add(this);
show();
}
public void disable() {
if (task != null) {
task.cancel();
currentCountdowns.remove(this);
task = null;
}
}
public static void skip() {
if (currentCountdowns.isEmpty()) return;
int smallestTime = currentCountdowns.get(0).time;
for (Countdown countdown : currentCountdowns) {
if (countdown.time < smallestTime) smallestTime = countdown.time;
}
for (Countdown countdown : new ArrayList<>(currentCountdowns)) {
countdown.time -= smallestTime;
countdown.show();
}
FightUI.addSubtitle("UI_SKIP");
}
public static void sendCountdownMessage(Player p, String message, int displaytime, Message appendix) {
FightSystem.getMessage().sendPrefixless(message, p, ChatMessageType.ACTION_BAR, displaytime, FightSystem.getMessage().parse(appendix.getMsg(), p, appendix.getParams()));
}
protected void broadcast(String message, int divisor) {
if (this.sound != null && divisor == 1) {
Fight.playSound(this.sound, 100.0F, 1.0F);
}
GlobalRecorder.getInstance().countdown(message, time / divisor, appendix);
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix));
}
public int getTimeLeft() {
return time;
}
private void count() {
time--;
show();
}
private void show() {
switch (time) {
case 900:
case 600:
case 300:
case 180:
case 120:
broadcast("COUNTDOWN_MINUTES", 60);
break;
case 60:
case 30:
case 20:
case 15:
case 10:
case 5:
case 4:
case 3:
case 2:
broadcast("COUNTDOWN_SECONDS", 1);
break;
case 1:
broadcast("COUNTDOWN_SECOND", 1);
break;
case 0:
if (this.sound != null) {
Fight.playSound(this.sound, 100.0F, 2.0F);
}
disable();
countdownFinished();
break;
default:
}
if (this.level) {
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(time));
}
}
}
@@ -27,12 +27,10 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.gamecore.countdown.StandardCountdown;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
public class EnternCountdown extends StandardCountdown {
public class EnternCountdown extends Countdown {
private static int calcTime(FightPlayer fp, Countdown countdown) {
int time = Config.GameModeConfig.EnterStages.get(fp.getKit().getEnterStage());
@@ -48,17 +46,13 @@ public class EnternCountdown extends StandardCountdown {
private final FightPlayer fightPlayer;
public EnternCountdown(FightPlayer fp, Countdown countdown) {
super(
FightSystem.getPlugin(),
calcTime(fp, countdown),
FightCountdownAdapter.playerPresentation(fp, new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING)
);
super(calcTime(fp, countdown), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
fightPlayer = fp;
enable();
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
Bukkit.getPluginManager().callEvent(new BoardingEvent(fightPlayer));
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR);
fightPlayer.ifPlayer(player -> {
@@ -67,4 +61,11 @@ public class EnternCountdown extends StandardCountdown {
});
}
@Override
protected void broadcast(String message, int divisor) {
fightPlayer.ifPlayer(player -> {
player.playSound(player.getLocation(), sound, 100.0f, 1.0f);
sendCountdownMessage(player, message, time / divisor, appendix);
});
}
}
@@ -19,27 +19,25 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.linkage.Linked;
@Linked
public class EventSpectateCountdown extends StandardCountdown {
public class EventSpectateCountdown extends Countdown {
public EventSpectateCountdown() {
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.SpectatorDuration, FightCountdownAdapter.presentation(new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.NotRestartable.contains(GameConfig.mode) && !GameConfig.replayserver(), FightState.Spectate, this);
super(Config.GameModeConfig.Times.SpectatorDuration, new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.NotRestartable.contains(Config.mode) && !Config.replayserver(), FightState.Spectate, this);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
FightSystem.shutdown();
}
}
@@ -1,91 +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.
*/
package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.CountdownMessageSink;
import de.steamwar.gamecore.countdown.CountdownPresentation;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
* Binds FightSystem's transports to GameCore's presentation engine.
*/
public final class FightCountdownAdapter {
private FightCountdownAdapter() {
}
public static CountdownPresentation presentation(Message appendix, SWSound sound, boolean level) {
return presentation(
appendix,
sound,
level,
(message, displayTime) -> {
GlobalRecorder.getInstance().countdown(message.getKey(), displayTime, appendix);
Bukkit.getOnlinePlayers().forEach(player ->
sendCountdownMessage(player, message.getKey(), displayTime, appendix)
);
}
);
}
public static CountdownPresentation presentation(
Message appendix,
SWSound sound,
boolean level,
CountdownMessageSink messageSink
) {
return new CountdownPresentation(
messageSink,
sound != null
? pitch -> Fight.playSound(sound.getSound(), 100.0F, pitch)
: null,
level
? timeLeft -> Bukkit.getOnlinePlayers().forEach(player -> player.setLevel(timeLeft))
: null
);
}
public static CountdownPresentation playerPresentation(
FightPlayer fightPlayer,
Message appendix,
SWSound sound
) {
return new CountdownPresentation(
(message, displayTime) -> fightPlayer.ifPlayer(player ->
sendCountdownMessage(player, message.getKey(), displayTime, appendix)
),
pitch -> fightPlayer.ifPlayer(player ->
player.playSound(player.getLocation(), sound.getSound(), 100.0F, pitch)
),
pitch -> Fight.playSound(sound.getSound(), 100.0F, pitch),
null,
true
);
}
public static void sendCountdownMessage(Player player, String message, int displayTime, Message appendix) {
FightSystem.getMessage().sendPrefixless(
message,
player,
ChatMessageType.ACTION_BAR,
displayTime,
FightSystem.getMessage().parse(appendix.getMsg(), player, appendix.getParams())
);
}
}
@@ -19,30 +19,27 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
@Linked
public class NoPlayersOnlineCountdown extends StandardCountdown {
public class NoPlayersOnlineCountdown extends Countdown {
public NoPlayersOnlineCountdown() {
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.NoPlayersOnlineDuration, FightCountdownAdapter.presentation(new Message("SHUTDOWN_COUNTDOWN"), null, false));
super(Config.GameModeConfig.Times.NoPlayersOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
if (!Config.GameModeConfig.Arena.Leaveable) {
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreLeaderSetup, this);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
}
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
Bukkit.getServer().shutdown();
}
}
@@ -19,30 +19,27 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
@Linked
public class PostSchemCountdown extends StandardCountdown {
public class PostSchemCountdown extends Countdown {
public PostSchemCountdown() {
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.SetupDuration, FightCountdownAdapter.presentation(new Message("POST_SCHEM_COUNTDOWN"), null, false));
if (GameConfig.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
super(Config.GameModeConfig.Times.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
if (Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
return;
}
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.SeriousFight.contains(GameConfig.mode), FightState.PostSchemSetup, this);
new StateDependentCountdown(ArenaMode.SeriousFight, FightState.PostSchemSetup, this);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
FightState.setFightState(FightState.PRE_RUNNING);
}
}
@@ -19,27 +19,24 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
@Linked
public class PreRunningCountdown extends StandardCountdown {
public class PreRunningCountdown extends Countdown {
public PreRunningCountdown() {
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.PreFightDuration, FightCountdownAdapter.presentation(new Message("PRE_RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, true));
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreRunning, this);
super(Config.GameModeConfig.Times.PreFightDuration, new Message("PRE_RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, true);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreRunning, this);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
FightState.setFightState(FightState.RUNNING);
}
}
@@ -19,27 +19,24 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
@Linked
public class PreSchemCountdown extends StandardCountdown {
public class PreSchemCountdown extends Countdown {
public PreSchemCountdown() {
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.PreSchemPasteDuration, FightCountdownAdapter.presentation(new Message("PRE_SCHEM_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreSchemSetup, this);
super(Config.GameModeConfig.Times.PreSchemPasteDuration, new Message("PRE_SCHEM_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreSchemSetup, this);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
FightState.setFightState(FightState.POST_SCHEM_SETUP);
}
}
@@ -19,27 +19,24 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
@Linked
public class SpectateOverCountdown extends StandardCountdown {
public class SpectateOverCountdown extends Countdown {
public SpectateOverCountdown() {
super(FightSystem.getPlugin(), GameConfig.test() ? 3600 : Config.GameModeConfig.Times.SpectatorDuration, FightCountdownAdapter.presentation(new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.Restartable.contains(GameConfig.mode) || GameConfig.replayserver(), FightState.Spectate, this);
super(Config.test() ? 3600 : Config.GameModeConfig.Times.SpectatorDuration, new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Spectate, this);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
FightState.setFightState(FightState.PRE_LEADER_SETUP);
}
}
@@ -20,22 +20,20 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.gamecore.countdown.StandardCountdown;
public class TimeOverCountdown extends StandardCountdown {
public class TimeOverCountdown extends Countdown {
private final Runnable timeOver;
public TimeOverCountdown(Runnable timeOver) {
super(FightSystem.getPlugin(), Config.GameModeConfig.WinConditionParams.TimeoutTime, FightCountdownAdapter.presentation(new Message("RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, false));
super(Config.GameModeConfig.WinConditionParams.TimeoutTime, new Message("RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, false);
this.timeOver = timeOver;
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
timeOver.run();
}
}
@@ -21,14 +21,13 @@ package de.steamwar.fightsystem.event;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType;
@@ -140,14 +139,14 @@ public class HellsBells {
}.register();
}
private class HellsBellsCountdown extends StandardCountdown {
private class HellsBellsCountdown extends Countdown {
public HellsBellsCountdown(int time) {
super(FightSystem.getPlugin(), time, FightCountdownAdapter.presentation(new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true));
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
drop();
startCountdown();
}
@@ -241,4 +240,4 @@ public class HellsBells {
return this == NORTH || this == WEST;
}
}
}
}
@@ -21,7 +21,7 @@ package de.steamwar.fightsystem.event;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
@@ -29,7 +29,6 @@ import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.entity.Fireball;
@@ -155,14 +154,14 @@ public class Meteor implements Listener {
}.register();
}
private class MeteorCountdown extends StandardCountdown {
private class MeteorCountdown extends Countdown {
public MeteorCountdown(int time) {
super(FightSystem.getPlugin(), time, FightCountdownAdapter.presentation(new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true));
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
drop();
startCountdown();
}
@@ -213,4 +212,4 @@ public class Meteor implements Listener {
}
}
}
}
}
@@ -20,8 +20,8 @@
package de.steamwar.fightsystem.event;
import com.sk89q.worldedit.WorldEditException;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
@@ -37,7 +37,7 @@ import java.util.logging.Level;
public class PersistentDamage {
public PersistentDamage() {
if (!ArenaMode.SeriousFight.contains(GameConfig.mode)) return;
if (!ArenaMode.SeriousFight.contains(Config.mode)) return;
new OneShotStateDependent(Winconditions.PERSISTENT_DAMAGE, FightState.Spectate, () -> Fight.teams().forEach(team -> {
try {
@@ -19,11 +19,9 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.gamecore.team.TeamRegistry;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Registry;
@@ -31,24 +29,41 @@ import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import java.util.Collection;
import java.util.List;
import java.util.HashSet;
public class Fight {
private Fight() {
}
@Getter
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, GameConfig.RedLeader);
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader);
@Getter
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, GameConfig.BlueLeader);
private static final TeamRegistry<FightTeam, LivingEntity> teamRegistry = new TeamRegistry<>(List.of(redTeam, blueTeam));
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader);
private static final Collection<FightTeam> teams = new HashSet<>();
static {
teams.add(redTeam);
teams.add(blueTeam);
}
public static FightTeam getPlayerTeam(LivingEntity player) {
return teamRegistry.findTeam(player);
if (redTeam.isPlayerInTeam(player)) {
return redTeam;
}
if (blueTeam.isPlayerInTeam(player)) {
return blueTeam;
}
return null;
}
public static FightTeam getOpposite(FightTeam fightTeam) {
return teamRegistry.opposite(fightTeam);
if (fightTeam == redTeam) {
return blueTeam;
} else if (fightTeam == blueTeam) {
return redTeam;
}
throw new IllegalArgumentException();
}
public static FightPlayer getFightPlayer(LivingEntity player) {
@@ -66,11 +81,7 @@ public class Fight {
}
public static Collection<FightTeam> teams() {
return teamRegistry.getTeams();
}
public static boolean allTeamsReady() {
return teamRegistry.allReady();
return teams;
}
public static FightTeam getUnrotated() {
@@ -84,14 +95,20 @@ public class Fight {
}
public static FightTeam getTeamByName(String name) {
return teamRegistry.findById(name);
if (redTeam.getName().equalsIgnoreCase(name)) {
return redTeam;
}
if (blueTeam.getName().equalsIgnoreCase(name)) {
return blueTeam;
}
return null;
}
public static boolean publicOnly() {
if (Config.OnlyPublicSchematics) {
return true;
}
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(GameConfig.mode)) {
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) {
return false;
}
if (redTeam.getLeader() == null || blueTeam.getLeader() == null) {
@@ -21,7 +21,7 @@ package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.ai.AI;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.countdown.EnternCountdown;
import de.steamwar.fightsystem.events.TeamDeathEvent;
import de.steamwar.sql.PersonalKit;
@@ -22,8 +22,7 @@ package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.transform.AffineTransform;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.record.GlobalRecorder;
@@ -131,7 +130,7 @@ public class FightSchematic extends StateDependent {
setSchematic(publics.get(new Random().nextInt(publics.size())));
}
if (ArenaMode.AntiReplay.contains(GameConfig.mode)) {
if (ArenaMode.AntiReplay.contains(Config.mode)) {
boolean changeRotation = false;
if (Config.GameModeConfig.WinConditions.contains(Winconditions.RANDOM_ROTATE)) {
changeRotation = new Random().nextBoolean();
@@ -149,7 +148,7 @@ public class FightSchematic extends StateDependent {
private void replaceTeamColor(Clipboard clipboard) {
try {
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(GameConfig.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
} catch (WorldEditException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor schematic", e);
}
@@ -174,7 +173,7 @@ public class FightSchematic extends StateDependent {
);
FightSystem.getHullHider().initialize(team);
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
if (ArenaMode.Check.contains(GameConfig.mode) && !team.isBlue()) {
if (ArenaMode.Check.contains(Config.mode) && !team.isBlue()) {
replaceSync(Material.TNT, Material.RED_WOOL);
}
@@ -183,7 +182,7 @@ public class FightSchematic extends StateDependent {
@Override
public void disable() {
if (GameConfig.mode == ArenaMode.PREPARE) {
if (Config.mode == ArenaMode.PREPARE) {
return;
}
@@ -20,13 +20,12 @@
package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.ai.AIManager;
import de.steamwar.fightsystem.commands.GUI;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.events.TeamLeaveEvent;
import de.steamwar.fightsystem.events.TeamSpawnEvent;
import de.steamwar.fightsystem.listener.FightScoreboard;
@@ -58,7 +57,7 @@ import java.util.*;
import java.util.function.Consumer;
public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntity> {
public class FightTeam {
private static void setKitButton(HotbarKit kit, boolean leader) {
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits) {
@@ -80,14 +79,14 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
static {
setKitButton(notReadyKit, true);
if (ArenaMode.VariableTeams.contains(GameConfig.mode)) {
if (ArenaMode.VariableTeams.contains(Config.mode)) {
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
if (!AIManager.availableAIs().isEmpty()) {
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
}
}
if (GameConfig.test()) {
if (Config.test()) {
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
}
@@ -164,7 +163,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
}
new OneShotStateDependent(ArenaMode.Restartable, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
new OneShotStateDependent(GameConfig.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
if (leader != null) leader.ifPlayer(notReadyKit::loadToPlayer);
});
@@ -237,7 +236,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), SteamwarUser.get(uuid), true));
if (ArenaMode.VariableTeams.contains(GameConfig.mode) && isLeaderless()) {
if (ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()) {
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
Collections.shuffle(onlinePlayers);
for (Player player : onlinePlayers) {
@@ -339,7 +338,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
FightSystem.getHullHider().updatePlayer(player);
FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, Fight.getOpposite(this).getExtendRegion());
if (ArenaMode.VariableTeams.contains(GameConfig.mode)) {
if (ArenaMode.VariableTeams.contains(Config.mode)) {
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
}
}
@@ -357,7 +356,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
this.leader = null;
if (!players.isEmpty()) {
setLeader(players.values().iterator().next(), false);
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(GameConfig.mode)) {
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)) {
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> FightState.setFightState(FightState.PRE_LEADER_SETUP), 1);
}
}
@@ -405,31 +404,6 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
return players.values();
}
@Override
public String teamId() {
return name;
}
@Override
public Collection<LivingEntity> members() {
return players.values().stream().map(FightPlayer::getEntity).toList();
}
@Override
public LivingEntity leader() {
return leader == null ? null : leader.getEntity();
}
@Override
public boolean ready() {
return ready;
}
@Override
public boolean contains(LivingEntity member) {
return isPlayerInTeam(member);
}
public void pasteSchem() {
testPasteAction();
}
@@ -449,7 +423,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
}
private void testPasteAction() {
if (GameConfig.test()) {
if (Config.test()) {
this.schematic.enable();
} else if (Fight.getOpposite(this).schematic.hasSchematic()) {
FightState.setFightState(FightState.POST_SCHEM_SETUP);
@@ -481,7 +455,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
if (ready) {
broadcast("TEAM_READY");
leader.ifPlayer(readyKit::loadToPlayer);
if (Fight.allTeamsReady() || ArenaMode.SoloLeader.contains(GameConfig.mode)) {
if (Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode)) {
FightState.setFightState(FightState.PRE_RUNNING);
}
} else {
@@ -494,12 +468,10 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
this.skip = !skip;
if (skip) {
broadcast("SKIP_READY");
if (Fight.getOpposite(this).skip || GameConfig.test()) {
if (Fight.getOpposite(this).skip || Config.test()) {
skip = false;
Fight.getOpposite(this).skip = false;
if (Countdown.skipActive()) {
FightUI.addSubtitle("UI_SKIP");
}
Countdown.skip();
}
} else {
broadcast("SKIP_NOT_READY");
@@ -19,8 +19,7 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.listener.Recording;
@@ -47,7 +46,7 @@ public class FightWorld extends StateDependent {
private static final boolean PAPER = Bukkit.getVersion().contains("git-Paper");
public FightWorld() {
super(ArenaMode.Restartable.contains(GameConfig.mode) || GameConfig.replayserver(), FightState.Schem);
super(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Schem);
register();
}
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.listener.PersonalKitCreator;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.events.TeamDeathEvent;
import de.steamwar.fightsystem.events.TeamLeaveEvent;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.linkage.Linked;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -19,12 +19,13 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.linkage.Linked;
import de.steamwar.sql.GameModeConfig;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
@@ -44,14 +45,24 @@ public class Check implements Listener {
new StateDependentListener(ArenaMode.Check, FightState.All, this);
}
private boolean checkPermission(SteamwarUser user, SchematicNode schematic) {
GameModeConfig<Object, String> gameModeConfig = GameModeConfig.getAll().stream()
.filter(gmc -> gmc.Schematic.Type != null && gmc.Schematic.Type.equals(schematic.getSchemtype()))
.findFirst()
.orElse(null);
if (gameModeConfig == null) gameModeConfig = GameModeConfig.getDefaults();
if (user.hasPerm(UserPerm.ADMINISTRATION)) return true;
if (gameModeConfig.Checkers.isEmpty() && user.hasPerm(UserPerm.CHECK)) return true;
return gameModeConfig.Checkers.contains(user.getId());
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if (user.hasPerm(UserPerm.CHECK)) return;
SchematicNode schem = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
if (checkPermission(user, schem)) return;
if (user.getId() == schem.getOwner()) return;
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.scoreboard.SWScoreboard;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
@@ -19,8 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -86,7 +85,7 @@ public class Permanent implements Listener {
@EventHandler
public void onTpGM3(PlayerTeleportEvent e) {
if (ArenaMode.AntiTest.contains(GameConfig.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
if (ArenaMode.AntiTest.contains(Config.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
e.setCancelled(true);
FightSystem.getMessage().sendPrefixless("NO_TELEPORT", e.getPlayer(), ChatMessageType.ACTION_BAR);
e.getPlayer().kickPlayer(null);
@@ -19,11 +19,10 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
@@ -42,7 +41,7 @@ public class PistonListener implements Listener {
public PistonListener(Set<ArenaMode> condition, Consumer<BlockPistonEvent> leftAreaHandler) {
this.leftAreaHandler = leftAreaHandler;
if (!condition.contains(GameConfig.mode)) return;
if (!condition.contains(Config.mode)) return;
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
new StateDependentListener(!Config.GameModeConfig.Arena.AllowMissiles, FightState.All, this);
@@ -20,8 +20,7 @@
package de.steamwar.fightsystem.listener;
import com.sk89q.worldedit.WorldEditException;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -68,7 +67,7 @@ public class PrepareSchem implements Listener {
SchematicNode schem;
try {
schem = SchematicNode.getSchematicNode(GameConfig.PrepareSchemID);
schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
} catch (SecurityException e) {
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
Bukkit.shutdown();
@@ -20,7 +20,7 @@
package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.TeamDeathEvent;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
@@ -19,8 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -34,12 +33,12 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class Shutdown implements Listener {
public Shutdown() {
new StateDependentListener(ArenaMode.AntiEvent.contains(GameConfig.mode) && !GameConfig.replayserver(), FightState.All, this);
new StateDependentListener(ArenaMode.AntiEvent.contains(Config.mode) && !Config.replayserver(), FightState.All, this);
}
@EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) {
if (GameConfig.replayserver() || Config.GameModeConfig.Arena.Leaveable) return;
if (Config.replayserver() || Config.GameModeConfig.Arena.Leaveable) return;
//Shutdown server if nobody online
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) {
@@ -22,7 +22,7 @@ package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile;
import de.steamwar.core.ProtocolWrapper;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.events.BoardingEvent;
import de.steamwar.fightsystem.events.TeamDeathEvent;
@@ -19,8 +19,8 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -43,7 +43,7 @@ public class TestJoin implements Listener {
public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (GameConfig.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
if (Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
player.kickPlayer("");
return;
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
@@ -22,7 +22,6 @@ package de.steamwar.fightsystem.record;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.linkage.Linked;
import lombok.Getter;
@@ -37,7 +36,7 @@ public class FileRecorder extends StateDependent implements Recorder {
private DataOutputStream outputStream;
public FileRecorder() {
super(GameConfig.ReplayID == 0, FightState.Recording);
super(Config.ReplayID == 0, FightState.Recording);
register();
}
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.record;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.Config;
import java.io.File;
import java.io.IOException;
@@ -33,7 +33,7 @@ public class FileSource extends PacketSource {
}
public static void startReplay() {
if (GameConfig.replayserver()) {
if (Config.replayserver()) {
try {
new LiveServer();
} catch (IOException e) {
@@ -42,9 +42,9 @@ public class FileSource extends PacketSource {
return;
}
if (GameConfig.ReplayID > 0) {
if (Config.ReplayID > 0) {
try {
new FileSource(replayFile(GameConfig.ReplayID));
new FileSource(replayFile(Config.ReplayID));
} catch (IOException e) {
throw new SecurityException("Could not start replay", e);
}
@@ -24,11 +24,10 @@ import de.steamwar.core.WorldEditWrapper;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RPlayer;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FightWorld;
@@ -256,7 +255,7 @@ public class PacketProcessor implements Listener {
addREntity(entityId, new RPlayer(entityServer, user.getUUID(), user.getUserName(), Config.SpecSpawn));
team.addEntry(user.getUserName());
if (ArenaMode.Test.contains(GameConfig.mode)) {
if (ArenaMode.Test.contains(Config.mode)) {
entities.get(entityId).setGlowing(true);
}
});
@@ -394,7 +393,7 @@ public class PacketProcessor implements Listener {
int displaytime = source.readInt();
Message appendix = readMessage();
Bukkit.getOnlinePlayers().forEach(p -> FightCountdownAdapter.sendCountdownMessage(p, message, displaytime, appendix));
Bukkit.getOnlinePlayers().forEach(p -> Countdown.sendCountdownMessage(p, message, displaytime, appendix));
}
private void oldArenaInfo() throws IOException {
@@ -634,7 +633,7 @@ public class PacketProcessor implements Listener {
entities.clear();
freezer.disable();
if (!GameConfig.replayserver()) {
if (!Config.replayserver()) {
FightSystem.getMessage().broadcast("REPLAY_ENDS");
}
if (FightSystem.getLastWinner() != null) {
@@ -19,8 +19,7 @@
package de.steamwar.fightsystem.record;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
@@ -52,7 +51,7 @@ public interface Recorder {
default void enable() {
GlobalRecorder.getInstance().add(this);
if (ArenaMode.Event.contains(GameConfig.mode)) {
if (ArenaMode.Event.contains(Config.mode)) {
teamIds(Config.EventTeamBlueID, Config.EventTeamRedID);
}
@@ -1,12 +1,27 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.gamecore.state.GameStateMachine;
import de.steamwar.gamecore.state.IStateDependent;
import lombok.Getter;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
public enum FightState {
PRE_LEADER_SETUP,
@@ -16,58 +31,63 @@ public enum FightState {
RUNNING,
SPECTATE;
public static final Set<FightState> All = immutable(EnumSet.allOf(FightState.class));
public static final Set<FightState> PreLeaderSetup = immutable(EnumSet.of(PRE_LEADER_SETUP));
public static final Set<FightState> PreSchemSetup = immutable(EnumSet.of(PRE_SCHEM_SETUP));
public static final Set<FightState> PostSchemSetup = immutable(EnumSet.of(POST_SCHEM_SETUP));
public static final Set<FightState> PreRunning = immutable(EnumSet.of(PRE_RUNNING));
public static final Set<FightState> Running = immutable(EnumSet.of(RUNNING));
public static final Set<FightState> Spectate = immutable(EnumSet.of(SPECTATE));
public static final Set<FightState> Setup = immutable(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP));
public static final Set<FightState> Ingame = immutable(EnumSet.of(PRE_RUNNING, RUNNING));
public static final Set<FightState> TeamFix = immutable(EnumSet.of(PRE_RUNNING, RUNNING, SPECTATE));
public static final Set<FightState> Schem = complement(PRE_LEADER_SETUP, PRE_SCHEM_SETUP);
public static final Set<FightState> Recording = complement(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, SPECTATE);
public static final Set<FightState> AntiRunning = complement(RUNNING);
public static final Set<FightState> AntiIngame = complement(PRE_RUNNING, RUNNING);
public static final Set<FightState> AntiSpectate = complement(SPECTATE);
public static final Set<FightState> All = Collections.unmodifiableSet(EnumSet.allOf(FightState.class));
public static final GameStateMachine<FightState> lifecycle = new GameStateMachine<>(PRE_LEADER_SETUP);
public static final Set<FightState> PreLeaderSetup = Collections.unmodifiableSet(EnumSet.of(PRE_LEADER_SETUP));
public static final Set<FightState> PreSchemSetup = Collections.unmodifiableSet(EnumSet.of(PRE_SCHEM_SETUP));
public static final Set<FightState> PostSchemSetup = Collections.unmodifiableSet(EnumSet.of(POST_SCHEM_SETUP));
public static final Set<FightState> PreRunning = Collections.unmodifiableSet(EnumSet.of(PRE_RUNNING));
public static final Set<FightState> Running = Collections.unmodifiableSet(EnumSet.of(RUNNING));
public static final Set<FightState> Spectate = Collections.unmodifiableSet(EnumSet.of(SPECTATE));
public static void registerStateDependent(IStateDependent<FightState> stateDependent) {
lifecycle.registerStateDependent(stateDependent);
public static final Set<FightState> Setup = Collections.unmodifiableSet(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP));
public static final Set<FightState> Ingame = Collections.unmodifiableSet(EnumSet.of(PRE_RUNNING, RUNNING));
public static final Set<FightState> TeamFix = Collections.unmodifiableSet(EnumSet.of(PRE_RUNNING, RUNNING, SPECTATE));
public static final Set<FightState> Schem = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP)));
public static final Set<FightState> Recording = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, SPECTATE)));
public static final Set<FightState> AntiRunning = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RUNNING)));
public static final Set<FightState> AntiIngame = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_RUNNING, RUNNING)));
public static final Set<FightState> AntiSpectate = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(SPECTATE)));
@Getter
private static final Map<IStateDependent, Boolean> stateDependentFeatures = new HashMap<>();
@Getter
private static FightState fightState = PRE_LEADER_SETUP;
public static void registerStateDependent(IStateDependent stateDependent) {
if (stateDependent.enabled().isEmpty()) return;
boolean enabled = stateDependent.enabled().contains(fightState);
stateDependentFeatures.put(stateDependent, enabled);
if (enabled) stateDependent.enable();
}
public static void setFightState(FightState state) {
lifecycle.transitionTo(state);
}
fightState = state;
public static FightState getFightState() {
return lifecycle.getCurrentState();
}
for (Map.Entry<IStateDependent, Boolean> feature : stateDependentFeatures.entrySet()) {
//Enable feature if should be enabled and currently disabled
if (feature.getKey().enabled().contains(fightState) && !feature.getValue()) {
feature.getKey().enable();
feature.setValue(true);
}
public static Map<IStateDependent<FightState>, Boolean> getStateDependentFeatures() {
return lifecycle.getStateDependentFeatures();
//Disable feature if should be disabled and currently enabled
if (!feature.getKey().enabled().contains(fightState) && feature.getValue()) {
feature.getKey().disable();
feature.setValue(false);
}
}
}
public static boolean setup() {
return Setup.contains(getFightState());
return Setup.contains(fightState);
}
public static boolean ingame() {
return Ingame.contains(getFightState());
return Ingame.contains(fightState);
}
public static boolean infight() {
return getFightState() == RUNNING;
}
private static Set<FightState> complement(FightState first, FightState... remaining) {
EnumSet<FightState> excluded = EnumSet.of(first, remaining);
return immutable(EnumSet.complementOf(excluded));
}
private static Set<FightState> immutable(EnumSet<FightState> states) {
return Collections.unmodifiableSet(states);
return fightState == RUNNING;
}
}
@@ -1,5 +1,40 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
@Deprecated
public interface IStateDependent extends de.steamwar.gamecore.state.IStateDependent<FightState> {
import java.util.Set;
public interface IStateDependent {
/**
* @return returns a set containing
*/
Set<FightState> enabled();
/**
* Enables the state dependent object
*/
void enable();
/**
* Disables the state dependent object
*/
void disable();
}
@@ -1,22 +1,59 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.GameConfig;
import java.util.Set;
@Deprecated
public class OneShotStateDependent extends de.steamwar.gamecore.state.OneShotStateDependent<FightState> implements IStateDependent {
public OneShotStateDependent(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Runnable runnable) {
super(FightState.lifecycle, modes, GameConfig.mode, states, runnable);
public class OneShotStateDependent extends StateDependent {
private final Runnable runnable;
public OneShotStateDependent(Set<ArenaMode> mode, Set<FightState> states, Runnable runnable) {
super(mode, states);
this.runnable = runnable;
register();
}
public OneShotStateDependent(Winconditions wincondition, Set<FightState> states, Runnable runnable) {
this(Config.GameModeConfig.WinConditions.contains(wincondition), states, runnable);
super(Config.GameModeConfig.WinConditions.contains(wincondition), states);
this.runnable = runnable;
register();
}
public OneShotStateDependent(boolean active, Set<FightState> states, Runnable runnable) {
super(FightState.lifecycle, active, states, runnable);
super(active, states);
this.runnable = runnable;
register();
}
@Override
public void enable() {
runnable.run();
}
@Override
public void disable() {
//Do nothing, oneshot
}
}
@@ -1,22 +1,54 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.GameConfig;
import java.util.Set;
@Deprecated
public abstract class StateDependent extends de.steamwar.gamecore.state.StateDependent<FightState> implements IStateDependent {
public abstract class StateDependent implements IStateDependent {
private final Set<FightState> enabled;
private final boolean register;
protected StateDependent(Winconditions wincondition, Set<FightState> states) {
this(Config.GameModeConfig.WinConditions.contains(wincondition), states);
}
protected StateDependent(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states) {
super(FightState.lifecycle, modes, GameConfig.mode, states);
protected StateDependent(Set<ArenaMode> mode, Set<FightState> states) {
this(mode.contains(Config.mode), states);
}
protected StateDependent(boolean enabled, Set<FightState> states) {
super(FightState.lifecycle, enabled, states);
this.enabled = states;
this.register = enabled;
}
public void register() {
if (register) FightState.registerStateDependent(this);
}
@Override
public Set<FightState> enabled() {
return enabled;
}
}
@@ -1,20 +1,58 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.gamecore.GameConfig;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import java.util.Set;
@Deprecated
public class StateDependentCommand extends de.steamwar.gamecore.state.StateDependentCommand<FightState> implements IStateDependent {
private static final CommandExecutor unavailable = (sender, cmd, label, args) -> {
public class StateDependentCommand extends StateDependent {
private static final CommandExecutor unavailable = (sender, cmd, s, strings) -> {
FightSystem.getMessage().sendPrefixless("COMMAND_CURRENTLY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
return false;
};
public StateDependentCommand(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, String name, CommandExecutor executor) {
super(FightState.lifecycle, modes.contains(GameConfig.mode), states, FightSystem.getPlugin(), name, executor, unavailable);
private final PluginCommand command;
private final CommandExecutor executor;
public StateDependentCommand(Set<ArenaMode> mode, Set<FightState> states, String name, CommandExecutor executor) {
super(mode, states);
this.executor = executor;
this.command = FightSystem.getPlugin().getCommand(name);
assert command != null;
disable();
register();
}
@Override
public void enable() {
command.setExecutor(executor);
}
@Override
public void disable() {
command.setExecutor(unavailable);
}
}
@@ -0,0 +1,70 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.winconditions.Winconditions;
import java.util.Set;
public class StateDependentCountdown extends StateDependent {
private static Countdown mainCountdown = null;
public static Countdown getMainCountdown() {
return mainCountdown;
}
private final Countdown countdown;
public StateDependentCountdown(Set<ArenaMode> mode, Set<FightState> states, Countdown countdown) {
super(mode, states);
this.countdown = countdown;
register();
}
public StateDependentCountdown(Winconditions wincondition, Set<FightState> states, Countdown countdown) {
this(Config.GameModeConfig.WinConditions.contains(wincondition), states, countdown);
}
public StateDependentCountdown(boolean active, Set<FightState> states, Countdown countdown) {
super(active, states);
this.countdown = countdown;
register();
}
public Countdown getCountdown() {
return countdown;
}
@Override
public void enable() {
mainCountdown = countdown;
countdown.enable();
}
@Override
public void disable() {
countdown.disable();
if (mainCountdown == countdown) mainCountdown = null;
}
}
@@ -1,24 +1,63 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.GameConfig;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import java.util.Set;
@Deprecated
public class StateDependentListener extends de.steamwar.gamecore.state.StateDependentListener<FightState> implements IStateDependent {
public class StateDependentListener extends StateDependent {
private final Listener listener;
public StateDependentListener(Winconditions wincondition, Set<FightState> states, Listener listener) {
this(Config.GameModeConfig.WinConditions.contains(wincondition), states, listener);
super(Config.GameModeConfig.WinConditions.contains(wincondition), states);
this.listener = listener;
register();
}
public StateDependentListener(boolean active, Set<FightState> states, Listener listener) {
super(FightState.lifecycle, active, states, FightSystem.getPlugin(), listener);
public StateDependentListener(boolean enabled, Set<FightState> states, Listener listener) {
super(enabled, states);
this.listener = listener;
register();
}
public StateDependentListener(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Listener listener) {
super(FightState.lifecycle, modes, GameConfig.mode, states, FightSystem.getPlugin(), listener);
public StateDependentListener(Set<ArenaMode> mode, Set<FightState> states, Listener listener) {
super(mode, states);
this.listener = listener;
register();
}
@Override
public void enable() {
Bukkit.getPluginManager().registerEvents(listener, FightSystem.getPlugin());
}
@Override
public void disable() {
HandlerList.unregisterAll(listener);
}
}
@@ -1,23 +1,69 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.gamecore.GameConfig;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import java.util.Set;
@Deprecated
public class StateDependentTask extends de.steamwar.gamecore.state.StateDependentTask<FightState> implements IStateDependent {
public class StateDependentTask extends StateDependent {
private final Runnable runnable;
private final long delay;
private final long period;
private BukkitTask task = null;
public StateDependentTask(Winconditions wincondition, Set<FightState> states, Runnable runnable, long delay, long period) {
this(Config.GameModeConfig.WinConditions.contains(wincondition), states, runnable, delay, period);
}
public StateDependentTask(boolean active, Set<FightState> states, Runnable runnable, long delay, long period) {
super(FightState.lifecycle, active, states, FightSystem.getPlugin(), runnable, delay, period);
public StateDependentTask(boolean enabled, Set<FightState> states, Runnable runnable, long delay, long period) {
super(enabled, states);
this.runnable = runnable;
this.delay = delay;
this.period = period;
register();
}
public StateDependentTask(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Runnable runnable, long delay, long period) {
super(FightState.lifecycle, modes, GameConfig.mode, states, FightSystem.getPlugin(), runnable, delay, period);
public StateDependentTask(Set<ArenaMode> mode, Set<FightState> states, Runnable runnable, long delay, long period) {
super(mode, states);
this.runnable = runnable;
this.delay = delay;
this.period = period;
register();
}
@Override
public void enable() {
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), runnable, delay, period);
}
@Override
public void disable() {
task.cancel();
}
}
@@ -19,12 +19,11 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.linkage.Linked;
import de.steamwar.network.NetworkSender;
@@ -42,7 +41,6 @@ public class BungeeFightInfo {
}
private void send() {
Countdown mainCountdown = StateDependentCountdown.getMainCountdown(FightState.lifecycle);
NetworkSender.send(new FightInfoPacket(
Config.world.getName(),
Config.GameModeConfig.Schematic.Type.toDB(),
@@ -50,7 +48,7 @@ public class BungeeFightInfo {
Fight.getBlueTeam().getColoredName(),
Fight.getRedTeam().getColoredName(),
FightState.getFightState().name(),
mainCountdown != null ? mainCountdown.getTimeLeft() : 0,
StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0,
Fight.getBlueTeam().getLeader() != null ? Fight.getBlueTeam().getLeader().getUser().getId() : 0,
Fight.getRedTeam().getLeader() != null ? Fight.getRedTeam().getLeader().getUser().getId() : 0,
Fight.getBlueTeam().getSchematic(),
@@ -19,11 +19,10 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
@@ -126,7 +125,7 @@ public class FightStatistics {
savePlayerStats(fp, fightId);
}
if (ArenaMode.Event.contains(GameConfig.mode)) {
if (ArenaMode.Event.contains(Config.mode)) {
Config.EventKampf.setFight(fightId);
}
@@ -20,8 +20,7 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.core.TPSWatcher;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@@ -29,7 +28,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.winconditions.Wincondition;
import de.steamwar.linkage.Linked;
@@ -72,8 +71,7 @@ public class FightUI {
totalHearts = 1.0;
}
Countdown mainCountdown = StateDependentCountdown.getMainCountdown(FightState.lifecycle);
int timeLeft = mainCountdown != null ? mainCountdown.getTimeLeft() : 0;
int timeLeft = StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0;
String time = "§7" + (timeLeft / 60) + "§8:§7" + (timeLeft % 60 < 10 ? "0" : "") + (timeLeft % 60);
String bluePlayers = blue.getPrefix() + blue.getAlivePlayers() + "§8/§7" + blue.getPlayerCount();
String redPlayers = red.getPrefix() + red.getAlivePlayers() + "§8/§7" + red.getPlayerCount();
@@ -29,7 +29,6 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.gamecore.GameConfig;
import de.steamwar.techhider.AccessPrivilegeProvider;
import de.steamwar.techhider.TechHider;
import lombok.Getter;
@@ -59,7 +58,7 @@ import java.util.stream.Stream;
public class TechHiderWrapper extends StateDependent implements Listener {
public static final boolean ENABLED = !Config.OnlyPublicSchematics && !GameConfig.test() && Config.GameModeConfig.Techhider.Active;
public static final boolean ENABLED = !Config.OnlyPublicSchematics && !Config.test() && Config.GameModeConfig.Techhider.Active;
@Getter
private final ConcurrentHashMap<Player, Region> hiddenRegion = new ConcurrentHashMap<>();
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.winconditions;
import de.steamwar.gamecore.ArenaMode;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
@@ -20,12 +20,10 @@
package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.gamecore.wincondition.GameResult;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import lombok.Getter;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -33,12 +31,13 @@ import org.bukkit.entity.LivingEntity;
import java.util.ArrayList;
import java.util.List;
import java.util.function.ToDoubleFunction;
import java.util.stream.Collectors;
public abstract class Wincondition implements de.steamwar.gamecore.wincondition.WinCondition<FightTeam> {
public abstract class Wincondition {
@Getter
protected static WinconditionBasePercent percentWincondition = null;
protected static StateDependentCountdown<FightState> timeOverCountdown = null;
protected static StateDependentCountdown timeOverCountdown = null;
@Getter
protected static final List<PrintableWincondition> printableWinconditions = new ArrayList<>();
@@ -48,11 +47,6 @@ public abstract class Wincondition implements de.steamwar.gamecore.wincondition.
this.windescription = windescription;
}
@Override
public String id() {
return windescription;
}
public static Countdown getTimeOverCountdown() {
if (timeOverCountdown == null) return null;
return timeOverCountdown.getCountdown();
@@ -69,12 +63,12 @@ public abstract class Wincondition implements de.steamwar.gamecore.wincondition.
}
protected void comparisonWin(ToDoubleFunction<FightTeam> evaluate, String winMessage, String tieMessage) {
GameResult<FightTeam> result = de.steamwar.gamecore.wincondition.WinConditions.winnerByScore(Fight.teams(), evaluate);
if (result instanceof GameResult.Winner<FightTeam> winner) {
FightTeam team = winner.getWinner();
win(team, winMessage, team.getColoredName());
} else {
double max = Fight.teams().stream().mapToDouble(evaluate).max().orElseThrow(() -> new SecurityException("No teams present"));
List<FightTeam> teams = Fight.teams().stream().filter(team -> evaluate.applyAsDouble(team) == max).collect(Collectors.toList());
if (teams.size() > 1) {
win(null, tieMessage);
} else {
win(teams.get(0), winMessage, teams.get(0).getColoredName());
}
}
}
@@ -23,7 +23,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.TimeOverCountdown;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import java.util.function.ToDoubleFunction;
@@ -32,12 +32,7 @@ public abstract class WinconditionComparisonTimeout extends Wincondition {
public WinconditionComparisonTimeout(Winconditions wincondition, String windescription, String winMessage, ToDoubleFunction<FightTeam> evaluate) {
super(windescription);
if (Config.GameModeConfig.WinConditions.contains(wincondition)) {
timeOverCountdown = new StateDependentCountdown<>(
FightState.lifecycle,
true,
FightState.Running,
new TimeOverCountdown(() -> comparisonWin(evaluate, winMessage, "WIN_TIME_OVER"))
);
timeOverCountdown = new StateDependentCountdown(wincondition, FightState.Running, new TimeOverCountdown(() -> comparisonWin(evaluate, winMessage, "WIN_TIME_OVER")));
}
}
}
@@ -24,7 +24,7 @@ import de.steamwar.fightsystem.countdown.TimeOverCountdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.linkage.Linked;
@@ -54,12 +54,7 @@ public class WinconditionPoints extends WinconditionBasePercent implements Liste
new StateDependentListener(Winconditions.POINTS, FightState.Ingame, this);
if (Config.GameModeConfig.WinConditions.contains(Winconditions.POINTS)) {
timeOverCountdown = new StateDependentCountdown<>(
FightState.lifecycle,
true,
FightState.Running,
new TimeOverCountdown(this::timeOver)
);
timeOverCountdown = new StateDependentCountdown(Winconditions.POINTS, FightState.Running, new TimeOverCountdown(this::timeOver));
}
}
@@ -20,10 +20,7 @@
package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
@@ -112,17 +109,17 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
});
}
private class TechKOCountdown extends StandardCountdown {
private class TechKOCountdown extends Countdown {
private final FightTeam team;
public TechKOCountdown(FightTeam team, int countdownTime) {
super(FightSystem.getPlugin(), countdownTime, FightCountdownAdapter.presentation(new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false));
super(countdownTime, new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false);
this.team = team;
super.enable();
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
@@ -20,10 +20,7 @@
package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
import de.steamwar.gamecore.countdown.Countdown;
import de.steamwar.gamecore.countdown.StandardCountdown;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
@@ -103,16 +100,16 @@ public class WinconditionTimedDamageTechKO extends Wincondition implements Print
});
}
private class TechKOCountdown extends StandardCountdown {
private class TechKOCountdown extends Countdown {
private final FightTeam team;
public TechKOCountdown(FightTeam team, int countdownTime) {
super(FightSystem.getPlugin(), countdownTime, FightCountdownAdapter.presentation(new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false));
super(countdownTime, new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false);
this.team = team;
}
@Override
protected void countdownFinished() {
public void countdownFinished() {
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
@@ -22,7 +22,7 @@ package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.TimeOverCountdown;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.gamecore.state.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.linkage.Linked;
@Linked
@@ -31,12 +31,7 @@ public class WinconditionTimeout extends Wincondition {
public WinconditionTimeout() {
super("Timeout");
if (Config.GameModeConfig.WinConditions.contains(Winconditions.TIMEOUT)) {
timeOverCountdown = new StateDependentCountdown<>(
FightState.lifecycle,
true,
FightState.Running,
new TimeOverCountdown(this::timeOver)
);
timeOverCountdown = new StateDependentCountdown(Winconditions.TIMEOUT, FightState.Running, new TimeOverCountdown(this::timeOver));
}
}
+1 -2
View File
@@ -7,7 +7,6 @@ main: de.steamwar.fightsystem.FightSystem
softdepend:
- SpigotCore
depend:
- GameCore
- WorldEdit
api-version: "1.13"
@@ -29,4 +28,4 @@ commands:
tpslimit:
tpswarp:
techhiderbug:
unrank:
unrank:
-5
View File
@@ -30,11 +30,6 @@ dependencies {
implementation(project(":FightSystem:FightSystem_Core"))
}
tasks.withType<FightServer>().configureEach {
dependsOn(":KotlinCore:shadowJar")
dependsOn(":GameCore:jar")
}
tasks.register<FightServer>("HalloweenWS") {
group = "run"
description = "Run a Halloween 1.21 Fight Replay Server"
-35
View File
@@ -1,35 +0,0 @@
# GameCore
GameCore is the Kotlin runtime library shared by SteamWar game-mode plugins.
Its implementation is based on FightSystem, the most exhaustive game mode, and
contains the mechanics that do not depend on a specific arena:
- restartable Bukkit countdown scheduling, FightSystem milestone behavior,
message/sound/level presentation policy, and shared skip behavior;
- generic team contracts, team lookup, readiness, and opposite-team handling;
- reusable winner/draw results and score/last-remaining evaluation;
- the complete state-dependent lifecycle (one-shots, tasks, listeners, commands,
and countdowns);
- the FightSystem arena modes and shared JVM runtime configuration;
- observable, generic game-state transitions.
GameCore intentionally does not define a game-state enum. Each consumer supplies
its own enum to `GameStateMachine<S>` and the generic state-dependent classes, so
each game mode controls its valid states while sharing the lifecycle behavior.
```kotlin
enum class State { WAITING, RUNNING, END }
val lifecycle = GameStateMachine(State.WAITING)
StateDependentListener(
lifecycle,
true,
setOf(State.RUNNING),
plugin,
ingameListener,
)
```
FightSystem, MissileWars, TNTLeague, and TowerRun retain their own messages,
inventories, listeners, schematics, and concrete win rules. They depend on the
GameCore plugin at runtime; GameCore itself depends on KotlinCore.
-22
View File
@@ -1,22 +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.
*/
plugins {
steamwar.kotlin
}
dependencies {
compileOnly(libs.paperapi)
compileOnly(project(":KotlinCore", "default"))
testImplementation(libs.junit)
testImplementation(libs.hamcrest)
}
@@ -1,58 +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.
*/
package de.steamwar.gamecore
import java.util.Collections
import java.util.EnumSet
/**
* Canonical arena mode model, ported from FightSystem.
*/
enum class ArenaMode {
NORMAL,
EVENT,
TEST,
CHECK,
PREPARE,
REPLAY;
companion object {
@JvmField val All: Set<ArenaMode> = immutable(EnumSet.allOf(ArenaMode::class.java))
@JvmField val Normal: Set<ArenaMode> = immutable(EnumSet.of(NORMAL))
@JvmField val Check: Set<ArenaMode> = immutable(EnumSet.of(CHECK))
@JvmField val Event: Set<ArenaMode> = immutable(EnumSet.of(EVENT))
@JvmField val Test: Set<ArenaMode> = immutable(EnumSet.of(TEST, CHECK))
@JvmField val Prepare: Set<ArenaMode> = immutable(EnumSet.of(PREPARE))
@JvmField val Replay: Set<ArenaMode> = immutable(EnumSet.of(REPLAY, TEST))
@JvmField val AntiReplay: Set<ArenaMode> = complement(REPLAY)
@JvmField val AntiTest: Set<ArenaMode> = complement(TEST, CHECK)
@JvmField val AntiEvent: Set<ArenaMode> = complement(EVENT)
@JvmField val AntiTestCheckPrepare: Set<ArenaMode> = complement(TEST, CHECK, PREPARE)
@JvmField val AntiPrepare: Set<ArenaMode> = complement(PREPARE)
@JvmField val VariableTeams: Set<ArenaMode> = complement(EVENT, REPLAY, CHECK)
@JvmField val ManualTeams: Set<ArenaMode> = complement(EVENT, REPLAY)
@JvmField val RankedEvent: Set<ArenaMode> = immutable(EnumSet.of(EVENT, REPLAY))
@JvmField val Restartable: Set<ArenaMode> = immutable(EnumSet.of(NORMAL, TEST))
@JvmField val NotRestartable: Set<ArenaMode> = immutable(EnumSet.of(EVENT, REPLAY))
@JvmField val SoloLeader: Set<ArenaMode> = immutable(EnumSet.of(TEST, CHECK, PREPARE))
@JvmField val NotOnBau: Set<ArenaMode> = complement(TEST, CHECK, PREPARE, REPLAY)
@JvmField val SeriousFight: Set<ArenaMode> = complement(TEST, CHECK, REPLAY)
private fun complement(vararg modes: ArenaMode): Set<ArenaMode> =
immutable(EnumSet.complementOf(EnumSet.copyOf(modes.toSet())))
private fun immutable(modes: EnumSet<ArenaMode>): Set<ArenaMode> =
Collections.unmodifiableSet(modes)
}
}
@@ -1,65 +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.
*/
package de.steamwar.gamecore
import java.util.UUID
/**
* Runtime configuration shared by all GameCore game modes.
*
* The values are supplied as JVM system properties by the game server launcher.
*/
object GameConfig {
@JvmField
val CheckSchemID: Int = System.getProperty("checkSchemID", "0").toInt()
@JvmField
val PrepareSchemID: Int = System.getProperty("prepareSchemID", "0").toInt()
@JvmField
val ReplayID: Int = System.getProperty("replay", "0").toInt()
@JvmField
val ConfigFile: String = System.getProperty("config", "config.yml")
@JvmField
val EventKampfID: Int = System.getProperty("fightID", "0").toInt()
@JvmField
val BlueLeader: UUID? = System.getProperty("blueLeader")?.let(UUID::fromString)
@JvmField
val RedLeader: UUID? = System.getProperty("redLeader")?.let(UUID::fromString)
@JvmField
val mode: ArenaMode = resolveArenaMode(CheckSchemID, PrepareSchemID, EventKampfID, ReplayID)
@JvmStatic
fun test(): Boolean = ArenaMode.Test.contains(mode)
@JvmStatic
fun replayserver(): Boolean = ReplayID < 0
internal fun resolveArenaMode(
checkSchemID: Int,
prepareSchemID: Int,
eventKampfID: Int,
replayID: Int,
): ArenaMode = when {
checkSchemID != 0 -> ArenaMode.CHECK
prepareSchemID != 0 -> ArenaMode.PREPARE
eventKampfID >= 1 -> ArenaMode.EVENT
eventKampfID == -1 -> ArenaMode.TEST
replayID != 0 -> ArenaMode.REPLAY
else -> ArenaMode.NORMAL
}
}
@@ -1,22 +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.
*/
package de.steamwar.gamecore
import org.bukkit.plugin.java.JavaPlugin
/**
* Runtime boundary for code shared by the SteamWar game modes.
*
* GameCore intentionally has no game lifecycle of its own. Depending plugins
* provide the concrete teams, states, messages and win effects.
*/
class GameCore : JavaPlugin()

Some files were not shown because too many files have changed in this diff Show More