Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12e085600e | ||
|
|
f8cda32119 | ||
|
|
867ca6f5dc | ||
|
|
badff1c70f | ||
|
|
1d2ac4f705 | ||
|
|
b48c75ef74 | ||
|
|
8b6ea12a08 | ||
|
|
801678ddd3 | ||
|
|
e5cc874834 | ||
|
|
95119fc93f | ||
|
|
d84ca3547a | ||
|
|
25ab79abc0 | ||
|
|
582d6a62e3 | ||
|
|
5eec792aff
|
||
|
|
e0f26c3e8d
|
||
|
|
a59e9b4343 | ||
|
|
a8c68864d8 | ||
|
|
c0668723d7 | ||
|
|
5bc2daf37a | ||
|
|
e6d39da36b | ||
|
|
390d388692 | ||
|
|
9a60ac228c | ||
|
|
dab443b989 | ||
|
|
bf3c65c630 | ||
|
|
b488c4ed7c | ||
|
|
2e795aaf8e | ||
|
|
7a601235f5 | ||
|
|
62e855ec1b
|
||
|
|
9e7311934f | ||
|
|
6fd3e6f690
|
||
|
|
7acd51fd61
|
||
|
|
b278ca15f3
|
||
|
|
029249c2b0
|
||
|
|
1ceb10439b
|
||
|
|
a5dfe6ab7e
|
||
|
|
c8a5f567eb | ||
|
|
47fb4da85b
|
||
|
|
0eef22aab0 | ||
|
|
013d18614f | ||
|
|
c7c1ab64e0 | ||
|
|
b68a27fbb6 | ||
|
|
7038dc2aa5
|
||
|
|
7af586ec16
|
||
|
|
b04e99ce54 | ||
|
|
524702fbb9 | ||
|
|
e07298e748 | ||
|
|
e1df793e9f | ||
|
|
806a1affea | ||
|
|
c538cdbbd2 | ||
|
|
d7ba19049a | ||
|
|
47909b6f07 | ||
|
|
48846a698f | ||
|
|
b771c95b99 | ||
|
|
d0aada2b00 | ||
|
|
6522fc77f2 | ||
|
|
27e01a56ae | ||
|
|
ed89770c0f | ||
|
|
3ec3c90f04 | ||
|
|
73d4ed26c8 | ||
|
|
256bcfb1bf | ||
|
|
28ce288815 | ||
|
|
6599dd026a | ||
|
|
03052b677f | ||
|
|
f76a6fa79d | ||
|
|
7fb7f46ca7 | ||
|
|
1269b7f00a | ||
|
|
91a0685724 | ||
|
|
72dd2ef59a | ||
|
|
54a1549973 | ||
|
|
fd5f5b92b4 | ||
|
|
60dc5e4442 | ||
|
|
4cdaf759af | ||
|
|
6e919d9148 | ||
|
|
a20ec8c93d | ||
|
|
18b65a2984 | ||
|
|
7adb1e8b4a | ||
|
|
b88e592e79 | ||
|
|
914134600e | ||
|
|
70c8678c60
|
||
|
|
997292d58e | ||
|
|
8050f51424
|
||
|
|
a6681ffaf6
|
||
|
|
a23530074c
|
||
|
|
e88a4c624b
|
||
|
|
105beaf7a6 | ||
|
|
5f7ab3cd7b
|
||
|
|
5ce69e6b7a
|
||
|
|
9e43d5cd1b | ||
|
|
2ad9ae3c7f | ||
|
|
847eb3fe5d | ||
|
|
8fa9f7b0d3 | ||
|
|
559cae2b6d | ||
|
|
5dbf3638d0 |
@@ -15,6 +15,11 @@ bin/
|
||||
.vscode
|
||||
.settings
|
||||
|
||||
# Language Server
|
||||
**/.project
|
||||
**/.factorypath
|
||||
**/.classpath
|
||||
|
||||
# Other
|
||||
lib
|
||||
/WebsiteBackend/data
|
||||
|
||||
Generated
+151
@@ -0,0 +1,151 @@
|
||||
<?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>
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.kotlin
|
||||
steamwar.java
|
||||
widener
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":KotlinCore", "default"))
|
||||
|
||||
compileOnly(libs.axiom)
|
||||
compileOnly(libs.authlib)
|
||||
|
||||
@@ -22,7 +22,6 @@ package de.steamwar.bausystem;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.configplayer.ConfigConverter;
|
||||
import de.steamwar.bausystem.features.cannonCore.CannonCoreRegistrationKt;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||
@@ -136,8 +135,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
String identifier = BauServerInfo.getOwnerUser().getUUID().toString().replace("-", "");
|
||||
WorldIdentifier.set("bau/" + Core.getVersion() + "/" + identifier);
|
||||
|
||||
CannonCoreRegistrationKt.register(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.cannonCore
|
||||
|
||||
import de.steamwar.entity.RBlockDisplay
|
||||
import de.steamwar.entity.REntityAction
|
||||
import de.steamwar.entity.REntityServer
|
||||
import de.steamwar.entity.RInteraction
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class CannonCoreEntity: RBlockDisplay {
|
||||
val entityMaterial = Material.COMMAND_BLOCK
|
||||
|
||||
val hitbox: RInteraction
|
||||
|
||||
constructor(server: REntityServer, location: Location, onClick: (player: Player, clickAction: REntityAction) -> Unit) : super(server, location) {
|
||||
setBlock(entityMaterial.createBlockData())
|
||||
|
||||
hitbox = RInteraction(server, location)
|
||||
hitbox.setCallback(onClick)
|
||||
}
|
||||
|
||||
override fun die() {
|
||||
super.die()
|
||||
hitbox.die()
|
||||
}
|
||||
}
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.cannonCore
|
||||
|
||||
import de.steamwar.bausystem.BauSystem
|
||||
import de.steamwar.bausystem.utils.ItemUtils
|
||||
import de.steamwar.core.SWPlayer
|
||||
import de.steamwar.inventory.SWItem
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
|
||||
object CannonCoreWand : Listener {
|
||||
val wandId = "CANNON_CORE_WAND"
|
||||
val wandMaterial = Material.BREEZE_ROD
|
||||
|
||||
|
||||
fun getWandItem(): ItemStack {
|
||||
val title = "§eCannon Core Wand"
|
||||
val lore = listOf(
|
||||
"§eRight Click §8- §7Create a new cannon core"
|
||||
)
|
||||
|
||||
val wand = SWItem(wandMaterial, title, lore, false, null)
|
||||
val item = wand.itemStack
|
||||
return ItemUtils.setItem(item, wandId)
|
||||
}
|
||||
|
||||
fun isWandItem(itemStack: ItemStack?): Boolean {
|
||||
return ItemUtils.isItem(itemStack, wandId)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onPlayerEquip(event: PlayerItemHeldEvent) {
|
||||
val player = event.player
|
||||
val swPlayer = SWPlayer.of(event.player)
|
||||
val item = player.inventory.getItem(event.newSlot)
|
||||
|
||||
if (isWandItem(item)) {
|
||||
scheduleDisplayUpdate(player)
|
||||
} else {
|
||||
swPlayer.removeComponent(EmptyCannonCoreWandDisplay::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scheduleDisplayUpdate(player: Player) {
|
||||
BauSystem.runTaskLater(JavaPlugin.getPlugin(BauSystem::class.java), Runnable { updateDisplay(player) }, 2)
|
||||
}
|
||||
|
||||
private fun updateDisplay(player: Player) {
|
||||
if (isWandItem(player.inventory.itemInMainHand)) {
|
||||
EmptyCannonCoreWandDisplay(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.cannonCore
|
||||
|
||||
import de.steamwar.core.SWPlayer
|
||||
import de.steamwar.cursor.Cursor
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class EmptyCannonCoreWandDisplay : SWPlayer.Component {
|
||||
val coresDisplay: CannonCoresDisplay
|
||||
var cursor: Cursor
|
||||
|
||||
constructor(owner: Player) {
|
||||
coresDisplay = CannonCoresDisplay(owner)
|
||||
SWPlayer.of(owner).setComponent(this)
|
||||
|
||||
cursor = Cursor(
|
||||
coresDisplay.displayServer, owner, Material.GLASS, Material.COMMAND_BLOCK,
|
||||
listOf(
|
||||
Cursor.CursorMode.BLOCK_ALIGNED
|
||||
),
|
||||
) { location, hitEntity, action ->
|
||||
print("Hello")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMount(player: SWPlayer) {
|
||||
coresDisplay.onMount(player)
|
||||
}
|
||||
|
||||
override fun onUnmount(player: SWPlayer) {
|
||||
|
||||
player.getComponent(Cursor::class.java)
|
||||
.filter { it === cursor }
|
||||
.ifPresent { player.removeComponent(Cursor::class.java) }
|
||||
|
||||
coresDisplay.onUnmount(player)
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -185,17 +185,16 @@ public class TestblockCommand extends SWCommand {
|
||||
return new TypeMapper<SchematicNode>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
List<String> stringList = new ArrayList<>(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s));
|
||||
List<String> stringList = new ArrayList<>();
|
||||
stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.byId(0), s));
|
||||
stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s));
|
||||
return stringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchematicNode map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
||||
if (node == null) {
|
||||
node = SchematicNode.getNodeFromPath(SteamwarUser.byId(0), s);
|
||||
}
|
||||
SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.byId(0), s);
|
||||
if (node == null) node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
||||
return node;
|
||||
}
|
||||
};
|
||||
|
||||
+11
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.simulator;
|
||||
|
||||
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
@@ -77,8 +78,16 @@ public class SimulatorCursor implements Listener {
|
||||
return isSimulatorItem(player.getInventory().getItemInMainHand()) || isSimulatorItem(player.getInventory().getItemInOffHand());
|
||||
}
|
||||
|
||||
private static Set<Player> scheduledUpdates = new HashSet<>();
|
||||
|
||||
private static void scheduleCursorUpdate(Player player) {
|
||||
BauSystem.runTaskLater(BauSystem.getInstance(), () -> calcCursor(player), 1);
|
||||
scheduledUpdates.add(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerTickEnd(ServerTickEndEvent event) {
|
||||
scheduledUpdates.forEach(SimulatorCursor::calcCursor);
|
||||
scheduledUpdates.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -122,6 +131,7 @@ public class SimulatorCursor implements Listener {
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
cursorType.remove(event.getPlayer());
|
||||
removeCursor(event.getPlayer());
|
||||
scheduledUpdates.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
private static final Map<Player, Long> LAST_SNEAKS = new HashMap<>();
|
||||
|
||||
+5
-1
@@ -153,7 +153,11 @@ public class TraceCommand extends SWCommand {
|
||||
|
||||
@Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE")
|
||||
public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) {
|
||||
TraceManager.instance.isolate(player, records);
|
||||
if (records.length == 0) {
|
||||
TraceManager.instance.isolate(player, trace, trace.getRecords().toArray(TNTPoint[]::new));
|
||||
} else {
|
||||
TraceManager.instance.isolate(player, trace, records);
|
||||
}
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_ISOLATE", player);
|
||||
}
|
||||
|
||||
|
||||
+15
-6
@@ -347,9 +347,10 @@ public class TraceManager implements Listener {
|
||||
* Toggles the isolated render for the given records and player
|
||||
*
|
||||
* @param player the player the trace is shown to
|
||||
* @param records the record for which isolation is toggled
|
||||
* @param ptrace the trace for whitch isolation is toggled
|
||||
* @param records the records of the trace for which isolation is toggled
|
||||
*/
|
||||
public void isolate(Player player, TNTPoint... records) {
|
||||
public void isolate(Player player, Trace ptrace, TNTPoint... records) {
|
||||
unfollow(player);
|
||||
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
@@ -374,12 +375,20 @@ public class TraceManager implements Listener {
|
||||
isolateFlag.toggleId(record.getTntId());
|
||||
}
|
||||
|
||||
if (isolateFlag.isEmpty() && playerTraceShowData.hasViewFlagOnly(IsolateFlag.class) && records.length != 0) {
|
||||
playerTraceShowData.removeViewFlag(IsolateFlag.class);
|
||||
}
|
||||
|
||||
PlayerTraceShowData finalPlayerTraceShowData = playerTraceShowData;
|
||||
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
|
||||
trace.render(player, finalPlayerTraceShowData);
|
||||
followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> {
|
||||
trace.render(follower, finalPlayerTraceShowData);
|
||||
});
|
||||
if (trace.getUuid() == ptrace.getUuid() || finalPlayerTraceShowData.hasNoViewFlags()) {
|
||||
trace.render(player, finalPlayerTraceShowData);
|
||||
followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> {
|
||||
trace.render(follower, finalPlayerTraceShowData);
|
||||
});
|
||||
} else {
|
||||
trace.hide(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,13 @@ public class TraceRecorder implements Listener {
|
||||
Iterator<TNTPrimed> iter = trackedTNT.getOrDefault(region, Collections.emptyList()).iterator();
|
||||
while (iter.hasNext()) {
|
||||
TNTPrimed tnt = iter.next();
|
||||
if (tnt.isDead()) {
|
||||
iter.remove();
|
||||
tntSpawnRegion.remove(tnt);
|
||||
historyMap.remove(tnt);
|
||||
tntSpawnRegion.remove(tnt);
|
||||
continue;
|
||||
}
|
||||
if (tnt.getFuseTicks() == 80) continue;
|
||||
TNTPoint record = record(tnt, wrappedTrace, Collections.emptyList());
|
||||
if (record == null) {
|
||||
|
||||
+4
@@ -95,4 +95,8 @@ public class PlayerTraceShowData {
|
||||
public void addViewFlag(ViewFlag viewFlag) {
|
||||
viewFlags.put(viewFlag.getClass(), viewFlag);
|
||||
}
|
||||
|
||||
public <T extends ViewFlag> void removeViewFlag(Class<T> clazz) {
|
||||
viewFlags.remove(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -48,9 +48,9 @@ import static de.steamwar.bausystem.features.util.TNTClickListener.TNT_CLICK_DET
|
||||
*/
|
||||
public class TraceEntity extends RBlockDisplay {
|
||||
|
||||
private static final float TNT_VISUAL_SCALE = 0.98F;
|
||||
private static final float TNT_VISUAL_OFFSET = -TNT_VISUAL_SCALE / 2.0F;
|
||||
private static final Transformation TNT_VISUAL_TRANSFORM = new Transformation(
|
||||
public static final float TNT_VISUAL_SCALE = 0.98F;
|
||||
public static final float TNT_VISUAL_OFFSET = -TNT_VISUAL_SCALE / 2.0F;
|
||||
public static final Transformation TNT_VISUAL_TRANSFORM = new Transformation(
|
||||
new Vector3f(TNT_VISUAL_OFFSET, 0.0F, TNT_VISUAL_OFFSET),
|
||||
new Quaternionf(0, 0, 0, 1),
|
||||
new Vector3f(TNT_VISUAL_SCALE, TNT_VISUAL_SCALE, TNT_VISUAL_SCALE),
|
||||
|
||||
+2
@@ -131,6 +131,7 @@ public abstract class ViewFlag {
|
||||
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
|
||||
RBlockDisplay y = new RBlockDisplay(server, yLocation);
|
||||
y.setBlock(Material.WHITE_STAINED_GLASS.createBlockData());
|
||||
y.setTransform(TraceEntity.TNT_VISUAL_TRANSFORM);
|
||||
}
|
||||
|
||||
Location secoundLocation;
|
||||
@@ -143,6 +144,7 @@ public abstract class ViewFlag {
|
||||
if (secoundLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && secoundLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
|
||||
RBlockDisplay second = new RBlockDisplay(server, secoundLocation);
|
||||
second.setBlock(Material.WHITE_STAINED_GLASS.createBlockData());
|
||||
second.setTransform(TraceEntity.TNT_VISUAL_TRANSFORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -51,6 +51,10 @@ public class IsolateFlag extends ViewFlag {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return tntToIsolate.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<TNTPoint> filter(Stream<TNTPoint> records) {
|
||||
if (tntToIsolate.isEmpty()) return records;
|
||||
|
||||
@@ -139,6 +139,7 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlock(BlockCanBuildEvent event) {
|
||||
if (event.getPlayer() == null) return;
|
||||
if (SWPlayer.of(event.getPlayer()).hasComponent(NoClipData.class)) {
|
||||
event.setBuildable(true);
|
||||
}
|
||||
|
||||
@@ -20,30 +20,28 @@
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
public final class ItemUtils {
|
||||
@UtilityClass
|
||||
public class ItemUtils {
|
||||
|
||||
private static final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
|
||||
private final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
|
||||
|
||||
private ItemUtils() {
|
||||
}
|
||||
|
||||
public static boolean isItem(ItemStack itemStack, String tag) {
|
||||
public boolean isItem(ItemStack itemStack, String tag) {
|
||||
String value = getTag(itemStack, ITEM_KEY);
|
||||
return value != null && value.equals(tag);
|
||||
}
|
||||
|
||||
public static ItemStack setItem(ItemStack itemStack, String tag) {
|
||||
public void setItem(ItemStack itemStack, String tag) {
|
||||
setTag(itemStack, ITEM_KEY, tag);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static String getTag(ItemStack itemStack, NamespacedKey key) {
|
||||
public String getTag(ItemStack itemStack, NamespacedKey key) {
|
||||
if (itemStack == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -58,7 +56,7 @@ public final class ItemUtils {
|
||||
return container.get(key, PersistentDataType.STRING);
|
||||
}
|
||||
|
||||
public static void setTag(ItemStack itemStack, NamespacedKey key, String value) {
|
||||
public void setTag(ItemStack itemStack, NamespacedKey key, String value) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@ tasks.register<DevServer>("DevBau21") {
|
||||
dependsOn(":SpigotCore:shadowJar")
|
||||
dependsOn(":BauSystem:shadowJar")
|
||||
dependsOn(":SchematicSystem:shadowJar")
|
||||
dependsOn(":KotlinCore:shadowJar")
|
||||
template = "Bau21"
|
||||
debug = true
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.github.ajalt.mordant.rendering.TextColors
|
||||
import com.github.ajalt.mordant.rendering.TextStyles
|
||||
import de.steamwar.db.Database
|
||||
import de.steamwar.db.execute
|
||||
import de.steamwar.db.executeScript
|
||||
import de.steamwar.db.useDb
|
||||
import java.io.File
|
||||
|
||||
@@ -22,13 +23,25 @@ class ResetCommand : CliktCommand() {
|
||||
|
||||
val schema = schemaFile.readText()
|
||||
|
||||
val tables = execute("SHOW TABLES;") { it.getString(1) }
|
||||
for (table in tables) {
|
||||
execute("DROP TABLE IF EXISTS $table;") { }
|
||||
execute("SET FOREIGN_KEY_CHECKS=0;") { }
|
||||
|
||||
val databaseObjects = execute("SHOW FULL TABLES;") { it.getString(1) to it.getString(2) }
|
||||
for (view in databaseObjects.filter { it.second == "VIEW" }.map { it.first }) {
|
||||
execute("DROP VIEW IF EXISTS `${view.replace("`", "``")}`;") { }
|
||||
}
|
||||
for (table in databaseObjects.filter { it.second == "BASE TABLE" }.map { it.first }) {
|
||||
execute("DROP TABLE IF EXISTS `${table.replace("`", "``")}`;") { }
|
||||
}
|
||||
|
||||
execute(schema) { }
|
||||
executeScript(schema)
|
||||
|
||||
val seed = javaClass.getResource("/db/reset-seed.sql")
|
||||
?: throw CliktError("Reset seed file not found!")
|
||||
|
||||
executeScript(seed.readText())
|
||||
|
||||
execute("SET FOREIGN_KEY_CHECKS=1;") { }
|
||||
|
||||
echo(TextColors.brightGreen(TextStyles.bold("Database reset!")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,10 @@ class DevCommand : CliktCommand("dev") {
|
||||
if (!templateFile.exists()) {
|
||||
throw CliktError("Could not find world template: ${templateFile.absolutePath}")
|
||||
}
|
||||
worldFile.parentFile?.mkdirs()
|
||||
templateFile.copyRecursively(worldFile)
|
||||
}
|
||||
val worldDir = worldFile.parentFile ?: workingDir
|
||||
|
||||
val devFile = File("/configs/DevServer/${System.getProperty("user.name")}.$port.$version")
|
||||
if (System.getProperty("user.name") != "minecraft") {
|
||||
@@ -120,10 +122,11 @@ class DevCommand : CliktCommand("dev") {
|
||||
args, jvmArgs, listOf(
|
||||
jarFile,
|
||||
*(if (forceUpgrade) arrayOf("-forceUpgrade") else arrayOf()),
|
||||
"--log-strip-color",
|
||||
"--port", port.toString(),
|
||||
"--level-name", worldFile.name,
|
||||
"--world-dir", workingDir.absolutePath,
|
||||
"--nogui",
|
||||
"--world-dir", worldDir.absolutePath,
|
||||
"nogui",
|
||||
*(if (plugins != null) arrayOf("--plugins", plugins!!.absolutePathString()) else arrayOf())
|
||||
), serverDir
|
||||
)
|
||||
@@ -156,6 +159,16 @@ class DevCommand : CliktCommand("dev") {
|
||||
|
||||
val jvmArgOverrides = arrayOf("--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED")
|
||||
|
||||
val jvmNonJava8Params = arrayOf(
|
||||
*jvmArgOverrides,
|
||||
"-XX:-CRIUSecProvider"
|
||||
)
|
||||
|
||||
val extendedStartupParams = arrayOf(
|
||||
"-Dpaper.disablePluginRemapping=true",
|
||||
"-javaagent:/jars/AccessWidener.jar=start"
|
||||
)
|
||||
|
||||
val supportedVersionJars = mapOf(
|
||||
8 to "/jars/paper-1.8.8.jar",
|
||||
9 to "/jars/spigot-1.9.4.jar",
|
||||
@@ -228,13 +241,23 @@ class DevCommand : CliktCommand("dev") {
|
||||
}
|
||||
|
||||
fun runServer(args: List<String>, jvmArgs: List<String>, cmd: List<String>, serverDir: File) {
|
||||
val effectiveJvmArgs = mutableListOf<String>()
|
||||
effectiveJvmArgs += jvmArgs
|
||||
if (!isVelocity(server)) {
|
||||
extendedStartupParams.forEach { arg ->
|
||||
if (effectiveJvmArgs.none { it == arg }) {
|
||||
effectiveJvmArgs += arg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val process = ProcessBuilder(
|
||||
jvm?.absolutePath
|
||||
?: if (isJava8(server)) "/usr/lib/jvm/openj9-8/bin/java" else "java",
|
||||
*jvmArgs.toTypedArray(),
|
||||
?: if (isJava8(server)) "/usr/lib/jvm/openj9-8/bin/java" else "/usr/lib/jvm/openj9-21/bin/java",
|
||||
*effectiveJvmArgs.toTypedArray(),
|
||||
*args.toTypedArray(),
|
||||
*jvmDefaultParams,
|
||||
*(if (isJava8(server)) arrayOf() else jvmArgOverrides),
|
||||
*(if (isJava8(server)) arrayOf() else jvmNonJava8Params),
|
||||
*(if (profile) arrayOf("-javaagent:/jars/LixfelsProfiler.jar=start") else arrayOf()),
|
||||
"-Xshareclasses:nonfatal,name=$server",
|
||||
"-jar",
|
||||
|
||||
+120
-9
@@ -16,15 +16,14 @@ import java.sql.ResultSet
|
||||
import java.util.*
|
||||
|
||||
object Database {
|
||||
lateinit var host: String
|
||||
lateinit var port: String
|
||||
lateinit var database: String
|
||||
val host: String
|
||||
val port: String
|
||||
val database: String
|
||||
val username: String
|
||||
val password: String
|
||||
lateinit var db: Database
|
||||
|
||||
fun ensureConnected() {
|
||||
if (::db.isInitialized) {
|
||||
return
|
||||
}
|
||||
init {
|
||||
val config = File(System.getProperty("user.home"), "mysql.properties")
|
||||
|
||||
if (!config.exists()) {
|
||||
@@ -38,9 +37,14 @@ object Database {
|
||||
host = props.getProperty("host")
|
||||
port = props.getProperty("port")
|
||||
database = props.getProperty("database")
|
||||
username = props.getProperty("user")
|
||||
password = props.getProperty("password")
|
||||
}
|
||||
|
||||
val username = props.getProperty("user")
|
||||
val password = props.getProperty("password")
|
||||
fun ensureConnected() {
|
||||
if (::db.isInitialized) {
|
||||
return
|
||||
}
|
||||
|
||||
val url = "jdbc:mariadb://$host:$port/$database"
|
||||
|
||||
@@ -79,6 +83,113 @@ fun <T> JdbcTransaction.executeSingle(sql: String, transform: (ResultSet) -> T):
|
||||
}.single()
|
||||
}
|
||||
|
||||
fun JdbcTransaction.executeScript(sql: String) {
|
||||
for (statement in splitSqlScript(sql)) {
|
||||
exec(statement) { }
|
||||
}
|
||||
}
|
||||
|
||||
private fun splitSqlScript(sql: String): List<String> {
|
||||
val statements = mutableListOf<String>()
|
||||
val current = StringBuilder()
|
||||
var quote: Char? = null
|
||||
var inLineComment = false
|
||||
var inBlockComment = false
|
||||
var index = 0
|
||||
|
||||
fun addStatement() {
|
||||
val statement = current.toString().trim()
|
||||
if (statement.isNotEmpty()) {
|
||||
statements += statement
|
||||
}
|
||||
current.clear()
|
||||
}
|
||||
|
||||
while (index < sql.length) {
|
||||
val char = sql[index]
|
||||
val next = sql.getOrNull(index + 1)
|
||||
|
||||
if (inLineComment) {
|
||||
current.append(char)
|
||||
if (char == '\n') {
|
||||
inLineComment = false
|
||||
}
|
||||
index++
|
||||
continue
|
||||
}
|
||||
|
||||
if (inBlockComment) {
|
||||
current.append(char)
|
||||
if (char == '*' && next == '/') {
|
||||
current.append(next)
|
||||
inBlockComment = false
|
||||
index += 2
|
||||
} else {
|
||||
index++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (quote != null) {
|
||||
current.append(char)
|
||||
if (char == '\\' && quote != '`' && next != null) {
|
||||
current.append(next)
|
||||
index += 2
|
||||
continue
|
||||
}
|
||||
if (char == quote) {
|
||||
if (next == quote) {
|
||||
current.append(next)
|
||||
index += 2
|
||||
continue
|
||||
}
|
||||
quote = null
|
||||
}
|
||||
index++
|
||||
continue
|
||||
}
|
||||
|
||||
when {
|
||||
char == '-' && next == '-' -> {
|
||||
current.append(char).append(next)
|
||||
inLineComment = true
|
||||
index += 2
|
||||
}
|
||||
|
||||
char == '#' -> {
|
||||
current.append(char)
|
||||
inLineComment = true
|
||||
index++
|
||||
}
|
||||
|
||||
char == '/' && next == '*' -> {
|
||||
current.append(char).append(next)
|
||||
inBlockComment = true
|
||||
index += 2
|
||||
}
|
||||
|
||||
char == '\'' || char == '"' || char == '`' -> {
|
||||
current.append(char)
|
||||
quote = char
|
||||
index++
|
||||
}
|
||||
|
||||
char == ';' -> {
|
||||
addStatement()
|
||||
index++
|
||||
}
|
||||
|
||||
else -> {
|
||||
current.append(char)
|
||||
index++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addStatement()
|
||||
return statements
|
||||
}
|
||||
|
||||
fun useDb(statement: JdbcTransaction.() -> Unit) {
|
||||
de.steamwar.db.Database.ensureConnected()
|
||||
transaction(de.steamwar.db.Database.db, statement = statement)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -86,6 +86,24 @@ class CheckedSchematic(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
useDb {
|
||||
find { (CheckedSchematicTable.nodeOwner eq owner.id) and (CheckedSchematicTable.seen eq false) }.orderBy(CheckedSchematicTable.endTime to SortOrder.DESC).toList()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countAccepted(owner: SteamwarUser) =
|
||||
useDb {
|
||||
find { (CheckedSchematicTable.nodeOwner eq owner.id) and (CheckedSchematicTable.declineReason eq "freigegeben") }.count()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countAccepted(owner: SteamwarUser, type: String) =
|
||||
useDb {
|
||||
find { (CheckedSchematicTable.nodeOwner eq owner.id) and (CheckedSchematicTable.declineReason eq "freigegeben") and (CheckedSchematicTable.nodeType like "$type%") }.count()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countChecked(validator: SteamwarUser) =
|
||||
useDb {
|
||||
find { CheckedSchematicTable.validator eq validator.id }.count()
|
||||
}
|
||||
}
|
||||
|
||||
val node by CheckedSchematicTable.nodeId.transform({ it?.let { EntityID(it, SchematicNodeTable) } }, { it?.value })
|
||||
|
||||
@@ -130,6 +130,43 @@ class EventFight(id: EntityID<Int>) : IntEntity(id), Comparable<EventFight> {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countEventFights(fighter: SteamwarUser) =
|
||||
useDb {
|
||||
exec(
|
||||
"SELECT COUNT(DISTINCT F.FightID) AS FightCount FROM FightPlayer INNER JOIN Fight F on FightPlayer.FightID = F.FightID INNER JOIN EventFight EF on F.FightID = EF.Fight WHERE UserID = ?",
|
||||
args = listOf(IntegerColumnType() to fighter.id.value)
|
||||
) {
|
||||
if (it.next()) {
|
||||
it.getLong("FightCount")
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
?: 0
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countPlacement(fighter: SteamwarUser, placement: Int) =
|
||||
useDb {
|
||||
exec(
|
||||
"""
|
||||
SELECT COUNT(DISTINCT EventFight.EventID) AS PlacementCount FROM TeamTeilnahme
|
||||
INNER JOIN EventFight ON EventFight.EventID = TeamTeilnahme.EventID
|
||||
INNER JOIN FightPlayer ON FightPlayer.FightID = EventFight.Fight
|
||||
WHERE (IF(FightPlayer.Team = 1, EventFight.TeamBlue, EventFight.TeamRed)) = TeamTeilnahme.TeamID AND UserID = ? AND Placement = ?
|
||||
""".trimIndent(),
|
||||
args = listOf(IntegerColumnType() to fighter.id.value, IntegerColumnType() to placement)
|
||||
) {
|
||||
if (it.next()) {
|
||||
it.getInt("PlacementCount")
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
?: 0
|
||||
}
|
||||
}
|
||||
|
||||
val fightID by EventFightTable.id.transform({ EntityID(it, EventFightTable) }, { it.value })
|
||||
@@ -200,6 +237,7 @@ class EventFight(id: EntityID<Int>) : IntEntity(id), Comparable<EventFight> {
|
||||
|
||||
override fun delete() =
|
||||
useDb {
|
||||
EventRelation.deleteRelations(this@EventFight)
|
||||
super.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,10 +159,13 @@ class EventGroup(id: EntityID<Int>) : IntEntity(id) {
|
||||
}
|
||||
|
||||
override fun delete() =
|
||||
useDb { super.delete() }
|
||||
useDb {
|
||||
EventRelation.deleteRelations(this@EventGroup)
|
||||
super.delete()
|
||||
}
|
||||
|
||||
enum class EventGroupType {
|
||||
GROUP_STAGE,
|
||||
ELIMINATION_STAGE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import org.jetbrains.exposed.v1.core.and
|
||||
import org.jetbrains.exposed.v1.core.dao.id.EntityID
|
||||
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.or
|
||||
import org.jetbrains.exposed.v1.dao.IntEntity
|
||||
import org.jetbrains.exposed.v1.dao.IntEntityClass
|
||||
import org.jetbrains.exposed.v1.jdbc.deleteWhere
|
||||
import org.jetbrains.exposed.v1.jdbc.select
|
||||
|
||||
object EventRelationTable : IntIdTable("EventRelation") {
|
||||
@@ -59,6 +61,23 @@ class EventRelation(id: EntityID<Int>) : IntEntity(id) {
|
||||
fun getGroupRelations(group: EventGroup) =
|
||||
useDb { find { (EventRelationTable.fromId eq group.id.value) and (EventRelationTable.fromType eq FromType.GROUP) }.toList() }
|
||||
|
||||
@JvmStatic
|
||||
fun deleteRelations(fight: EventFight) =
|
||||
useDb {
|
||||
EventRelationTable.deleteWhere {
|
||||
(EventRelationTable.fightId eq fight.id) or
|
||||
((EventRelationTable.fromId eq fight.id.value) and (EventRelationTable.fromType eq FromType.FIGHT))
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun deleteRelations(group: EventGroup) =
|
||||
useDb {
|
||||
EventRelationTable.deleteWhere {
|
||||
(EventRelationTable.fromId eq group.id.value) and (EventRelationTable.fromType eq FromType.GROUP)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun create(fight: EventFight, fightTeam: FightTeam, fromType: FromType, fromId: Int, fromPlace: Int) =
|
||||
useDb {
|
||||
@@ -159,4 +178,4 @@ class EventRelation(id: EntityID<Int>) : IntEntity(id) {
|
||||
enum class FromType {
|
||||
FIGHT, GROUP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
package de.steamwar.sql
|
||||
|
||||
import de.steamwar.sql.internal.useDb
|
||||
import org.jetbrains.exposed.v1.core.IntegerColumnType
|
||||
import org.jetbrains.exposed.v1.core.VarCharColumnType
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeID
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeIdTable
|
||||
import org.jetbrains.exposed.v1.core.dao.id.EntityID
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.inList
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntity
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntityClass
|
||||
@@ -69,6 +72,28 @@ class FightPlayer(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
useDb {
|
||||
find { FightPlayerTable.fightId inList fightIds.toList() }.toList()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countFights(userId: Int) =
|
||||
useDb {
|
||||
find { FightPlayerTable.userId eq userId }.count()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun countFights(userId: Int, type: String) =
|
||||
useDb {
|
||||
exec(
|
||||
"SELECT COUNT(*) AS FightCount FROM FightPlayer INNER JOIN Fight F on FightPlayer.FightID = F.FightID WHERE UserID = ? AND GameMode LIKE ?",
|
||||
args = listOf(IntegerColumnType() to userId, VarCharColumnType() to "$type%")
|
||||
) {
|
||||
if (it.next()) {
|
||||
it.getInt("FightCount")
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
?: 0
|
||||
}
|
||||
}
|
||||
|
||||
val fightID by FightPlayerTable.fightId.transform({ EntityID(it, FightTable) }, { it.value })
|
||||
|
||||
@@ -146,12 +146,12 @@ public final class GameModeConfig<M, W> {
|
||||
public final List<String> CheckQuestions;
|
||||
|
||||
/**
|
||||
* The allowed checkers to check this schematic type denoted by a list of SteamWar ids.
|
||||
* The allowed checkers to check this schematic type denoted by a list of SteamwarUser ids.
|
||||
* The people need the {@link UserPerm#CHECK} to be able to check though.
|
||||
*
|
||||
* @implSpec {@code []} by default -> denoting every person with {@link UserPerm#CHECK} can check it
|
||||
*/
|
||||
public final List<Integer> Checkers;
|
||||
public final Set<Integer> Checkers;
|
||||
|
||||
/**
|
||||
* Bundle for countdowns during the fight
|
||||
@@ -246,7 +246,7 @@ public final class GameModeConfig<M, W> {
|
||||
}
|
||||
|
||||
CheckQuestions = loader.getStringList("CheckQuestions");
|
||||
Checkers = loader.getIntList("Checkers");
|
||||
Checkers = loader.getIntSet("Checkers");
|
||||
Times = new TimesConfig(loader.with("Times"));
|
||||
// Arena would be here to be in config order but needs Schematic.Size and EnterStages loaded afterwards
|
||||
Schematic = new SchematicConfig<>(loader.with("Schematic"));
|
||||
@@ -488,6 +488,27 @@ public final class GameModeConfig<M, W> {
|
||||
*/
|
||||
public final boolean NoFloor;
|
||||
|
||||
/**
|
||||
* Allows Wind Charges to cross the Middle.
|
||||
*
|
||||
* @implSpec {@code false} by default
|
||||
*/
|
||||
public final boolean WindchargesCanCrossMiddle;
|
||||
|
||||
/**
|
||||
* Allows Wind Charge interaction with Blocks.
|
||||
*
|
||||
* @implSpec {@code true} by default
|
||||
*/
|
||||
public final boolean WindchargesInteractWithBlocks;
|
||||
|
||||
/**
|
||||
* Allows Wind Charge to destroy Water.
|
||||
*
|
||||
* @implSpec {@code false} by default
|
||||
*/
|
||||
public final boolean WindchargesDestroyWater;
|
||||
|
||||
private ArenaConfig(YMLWrapper<M, W> loader, SchematicConfig.SizeConfig Size, List<Integer> EnterStages) {
|
||||
loaded = loader.canLoad();
|
||||
WaterDepth = loader.getInt("WaterDepth", 0);
|
||||
@@ -505,6 +526,9 @@ public final class GameModeConfig<M, W> {
|
||||
Leaveable = loader.getBoolean("Leaveable", false);
|
||||
AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty());
|
||||
NoFloor = loader.getBoolean("NoFloor", false);
|
||||
WindchargesCanCrossMiddle = loader.getBoolean("WindchargesCanCrossMiddle", false);
|
||||
WindchargesInteractWithBlocks = loader.getBoolean("WindchargesInteractWithBlocks", true);
|
||||
WindchargesDestroyWater = loader.getBoolean("WindchargesDestroyWater", false);
|
||||
}
|
||||
|
||||
@ToString
|
||||
@@ -929,6 +953,13 @@ public final class GameModeConfig<M, W> {
|
||||
*/
|
||||
public final boolean PersonalKits;
|
||||
|
||||
/**
|
||||
* Maximal blast resistance for the blocks in the kit
|
||||
*
|
||||
* @implSpec {@code 9.0} by default
|
||||
*/
|
||||
public final double MaxBlastResistance;
|
||||
|
||||
/**
|
||||
* Items (Valid spigot material values) that are not allowed in the personal kit
|
||||
*/
|
||||
@@ -940,7 +971,10 @@ public final class GameModeConfig<M, W> {
|
||||
MemberDefault = loader.getString("MemberDefault", "default");
|
||||
LeaderDefault = loader.getString("LeaderDefault", "default");
|
||||
PersonalKits = loader.getBoolean("PersonalKits", false);
|
||||
ForbiddenItems = loader.getMaterialList("ForbiddenItems");
|
||||
MaxBlastResistance = loader.getDouble("MaxBlastResistance", 9.0);
|
||||
List forbiddenItems = new ArrayList<>(loader.getMaterialList("ForbiddenItems"));
|
||||
forbiddenItems.addAll(SQLWrapper.impl.getMaterialWithGreaterBlastResistance(MaxBlastResistance));
|
||||
ForbiddenItems = Collections.unmodifiableList(forbiddenItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,12 @@ final class YMLWrapper<M, W> {
|
||||
return get(path, o -> (List<Integer>) o);
|
||||
}
|
||||
|
||||
public Set<Integer> getIntSet(String path) {
|
||||
List<Integer> list = get(path, o -> (List<Integer>) o);
|
||||
if (list.isEmpty()) return Collections.emptySet();
|
||||
return Collections.unmodifiableSet(new HashSet<>(list));
|
||||
}
|
||||
|
||||
public List<SchematicType> getSchematicTypeList(String path) {
|
||||
List<String> list = getStringList(path);
|
||||
if (list.isEmpty()) {
|
||||
|
||||
@@ -29,6 +29,7 @@ java {
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":GameCore", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.netty)
|
||||
|
||||
@@ -64,6 +64,10 @@ Arena:
|
||||
AllowMissiles: false # defaults to true if EnterStages are present otherwise 'false'
|
||||
# Denotes that there is no floor for this GameMode
|
||||
NoFloor: false # defaults to false if missing
|
||||
# Allows Wind Charges to cross the Middle.
|
||||
WindchargesCanCrossMiddle: false # defaults to false if missing
|
||||
# Allows Wind Charge interaction with Blocks.
|
||||
WindchargesInteractWithBlocks: false # defaults to false if missing
|
||||
|
||||
Schematic:
|
||||
# The size of the schematics
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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,6 +22,7 @@ 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;
|
||||
@@ -35,7 +36,6 @@ 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,8 +75,6 @@ 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;
|
||||
@@ -87,23 +85,12 @@ 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 {
|
||||
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");
|
||||
String configFile = GameConfig.ConfigFile;
|
||||
if (!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
FightSystem.getPlugin().saveDefaultConfig();
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||
@@ -209,7 +196,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 = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
int eventKampfID = GameConfig.EventKampfID;
|
||||
if (eventKampfID >= 1) {
|
||||
EventKampf = EventFight.byId(eventKampfID);
|
||||
if (EventKampf == null) {
|
||||
@@ -261,43 +248,8 @@ public class Config {
|
||||
Referees = Collections.emptySet();
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
LiveReplay = false;
|
||||
SpectatePort = -ReplayID;
|
||||
SpectatePort = -GameConfig.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,6 +36,8 @@ 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;
|
||||
@@ -75,7 +77,7 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
if (Config.SpectatePort != 0) {
|
||||
Core.setServerName("Spectate");
|
||||
} else if (Config.ReplayID != 0) {
|
||||
} else if (GameConfig.ReplayID != 0) {
|
||||
Core.setServerName("Replay");
|
||||
}
|
||||
|
||||
@@ -109,7 +111,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(Config.mode));
|
||||
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(GameConfig.mode));
|
||||
|
||||
hullHider = new HullHider();
|
||||
techHider = new TechHiderWrapper(hullHider);
|
||||
@@ -118,10 +120,10 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
FileSource.startReplay();
|
||||
|
||||
if (Config.mode == ArenaMode.EVENT) {
|
||||
if (GameConfig.mode == ArenaMode.EVENT) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
} else if (Config.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
} else if (GameConfig.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
|
||||
Fight.getBlueTeam().setSchem(checkSchematicNode);
|
||||
|
||||
if (checkSchematicNode.isPrepared()) {
|
||||
@@ -129,8 +131,8 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
new TechareaCommand();
|
||||
} else if (Config.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
|
||||
} else if (GameConfig.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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(Config.mode))
|
||||
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(GameConfig.mode))
|
||||
);
|
||||
|
||||
public static List<AIManager> availableAIs() {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Kit;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.ai.AIManager;
|
||||
@@ -56,7 +57,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(Config.mode) && team.canbeLeader(p)) {
|
||||
if (ArenaMode.ManualTeams.contains(GameConfig.mode) && team.canbeLeader(p)) {
|
||||
team.addMember(p);
|
||||
} else {
|
||||
JoinRequest.forPlayer(p, team);
|
||||
@@ -198,7 +199,7 @@ public class GUI {
|
||||
}
|
||||
|
||||
public static void preSchemDialog(Player p) {
|
||||
if (!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
if (!GameConfig.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +210,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 (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
|
||||
if (!GameConfig.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 -> {
|
||||
@@ -233,14 +234,14 @@ public class GUI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(Config.mode) && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
|
||||
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(GameConfig.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() && !Config.test()) {
|
||||
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !GameConfig.test()) {
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
@@ -253,7 +254,7 @@ public class GUI {
|
||||
}
|
||||
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked) {
|
||||
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
SchematicSelector selector = new SchematicSelector(p, GameConfig.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
schemSelect(p, node);
|
||||
});
|
||||
selector.setPublicMode(publicSchems ? SchematicSelector.PublicMode.PUBLIC_ONLY : SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
@@ -263,7 +264,7 @@ public class GUI {
|
||||
private static void schemSelect(Player p, SchematicNode node) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if (fightTeam == null) return;
|
||||
if (Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
if (GameConfig.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
fightTeam.pasteSchem(node);
|
||||
}
|
||||
p.closeInventory();
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -65,7 +66,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
|
||||
Player p = (Player) sender;
|
||||
|
||||
if (!(Config.test() || Config.isReferee(p))) {
|
||||
if (!(GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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(Config.mode) ? FightState.All : FightState.TeamFix, "skip", this);
|
||||
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(GameConfig.mode) ? FightState.All : FightState.TeamFix, "skip", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
|
||||
+3
-2
@@ -20,7 +20,8 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -49,7 +50,7 @@ public class TechhiderbugCommand implements CommandExecutor {
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
try {
|
||||
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
|
||||
writer.append("ArenaMode: ").append(GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-10
@@ -27,10 +27,12 @@ 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 Countdown {
|
||||
public class EnternCountdown extends StandardCountdown {
|
||||
|
||||
private static int calcTime(FightPlayer fp, Countdown countdown) {
|
||||
int time = Config.GameModeConfig.EnterStages.get(fp.getKit().getEnterStage());
|
||||
@@ -46,13 +48,17 @@ public class EnternCountdown extends Countdown {
|
||||
private final FightPlayer fightPlayer;
|
||||
|
||||
public EnternCountdown(FightPlayer fp, Countdown countdown) {
|
||||
super(calcTime(fp, countdown), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
|
||||
super(
|
||||
FightSystem.getPlugin(),
|
||||
calcTime(fp, countdown),
|
||||
FightCountdownAdapter.playerPresentation(fp, new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING)
|
||||
);
|
||||
fightPlayer = fp;
|
||||
enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
Bukkit.getPluginManager().callEvent(new BoardingEvent(fightPlayer));
|
||||
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR);
|
||||
fightPlayer.ifPlayer(player -> {
|
||||
@@ -61,11 +67,4 @@ public class EnternCountdown extends Countdown {
|
||||
});
|
||||
}
|
||||
|
||||
@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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+8
-6
@@ -19,25 +19,27 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.gamecore.countdown.StandardCountdown;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.StateDependentCountdown;
|
||||
import de.steamwar.fightsystem.utils.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.linkage.Linked;
|
||||
|
||||
@Linked
|
||||
public class EventSpectateCountdown extends Countdown {
|
||||
public class EventSpectateCountdown extends StandardCountdown {
|
||||
|
||||
public EventSpectateCountdown() {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
FightSystem.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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())
|
||||
);
|
||||
}
|
||||
}
|
||||
+9
-6
@@ -19,27 +19,30 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.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 Countdown {
|
||||
public class NoPlayersOnlineCountdown extends StandardCountdown {
|
||||
|
||||
public NoPlayersOnlineCountdown() {
|
||||
super(Config.GameModeConfig.Times.NoPlayersOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.NoPlayersOnlineDuration, FightCountdownAdapter.presentation(new Message("SHUTDOWN_COUNTDOWN"), null, false));
|
||||
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreLeaderSetup, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
Bukkit.getServer().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-7
@@ -19,27 +19,30 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.StateDependentCountdown;
|
||||
import de.steamwar.fightsystem.utils.Message;
|
||||
import de.steamwar.gamecore.countdown.StandardCountdown;
|
||||
import de.steamwar.linkage.Linked;
|
||||
|
||||
@Linked
|
||||
public class PostSchemCountdown extends Countdown {
|
||||
public class PostSchemCountdown extends StandardCountdown {
|
||||
|
||||
public PostSchemCountdown() {
|
||||
super(Config.GameModeConfig.Times.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
|
||||
if (Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
new StateDependentCountdown(ArenaMode.SeriousFight, FightState.PostSchemSetup, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.SeriousFight.contains(GameConfig.mode), FightState.PostSchemSetup, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
FightState.setFightState(FightState.PRE_RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-6
@@ -19,24 +19,27 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.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 Countdown {
|
||||
public class PreRunningCountdown extends StandardCountdown {
|
||||
|
||||
public PreRunningCountdown() {
|
||||
super(Config.GameModeConfig.Times.PreFightDuration, new Message("PRE_RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, true);
|
||||
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreRunning, this);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
FightState.setFightState(FightState.RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-6
@@ -19,24 +19,27 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.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 Countdown {
|
||||
public class PreSchemCountdown extends StandardCountdown {
|
||||
|
||||
public PreSchemCountdown() {
|
||||
super(Config.GameModeConfig.Times.PreSchemPasteDuration, new Message("PRE_SCHEM_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
|
||||
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreSchemSetup, this);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-6
@@ -19,24 +19,27 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.gamecore.state.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 Countdown {
|
||||
public class SpectateOverCountdown extends StandardCountdown {
|
||||
|
||||
public SpectateOverCountdown() {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
FightState.setFightState(FightState.PRE_LEADER_SETUP);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -20,20 +20,22 @@
|
||||
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 Countdown {
|
||||
public class TimeOverCountdown extends StandardCountdown {
|
||||
|
||||
private final Runnable timeOver;
|
||||
|
||||
public TimeOverCountdown(Runnable timeOver) {
|
||||
super(Config.GameModeConfig.WinConditionParams.TimeoutTime, new Message("RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, false);
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.WinConditionParams.TimeoutTime, FightCountdownAdapter.presentation(new Message("RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, false));
|
||||
this.timeOver = timeOver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
timeOver.run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@ package de.steamwar.fightsystem.event;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
|
||||
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;
|
||||
@@ -139,14 +140,14 @@ public class HellsBells {
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class HellsBellsCountdown extends Countdown {
|
||||
private class HellsBellsCountdown extends StandardCountdown {
|
||||
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
super(FightSystem.getPlugin(), time, FightCountdownAdapter.presentation(new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
@@ -240,4 +241,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.Countdown;
|
||||
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
@@ -29,6 +29,7 @@ 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;
|
||||
@@ -154,14 +155,14 @@ public class Meteor implements Listener {
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class MeteorCountdown extends Countdown {
|
||||
private class MeteorCountdown extends StandardCountdown {
|
||||
|
||||
public MeteorCountdown(int time) {
|
||||
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
super(FightSystem.getPlugin(), time, FightCountdownAdapter.presentation(new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
protected void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
@@ -212,4 +213,4 @@ public class Meteor implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,8 +20,8 @@
|
||||
package de.steamwar.fightsystem.event;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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(Config.mode)) return;
|
||||
if (!ArenaMode.SeriousFight.contains(GameConfig.mode)) return;
|
||||
|
||||
new OneShotStateDependent(Winconditions.PERSISTENT_DAMAGE, FightState.Spectate, () -> Fight.teams().forEach(team -> {
|
||||
try {
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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;
|
||||
@@ -29,41 +31,24 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
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, Config.RedLeader);
|
||||
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, GameConfig.RedLeader);
|
||||
@Getter
|
||||
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);
|
||||
}
|
||||
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));
|
||||
|
||||
public static FightTeam getPlayerTeam(LivingEntity player) {
|
||||
if (redTeam.isPlayerInTeam(player)) {
|
||||
return redTeam;
|
||||
}
|
||||
if (blueTeam.isPlayerInTeam(player)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
return teamRegistry.findTeam(player);
|
||||
}
|
||||
|
||||
public static FightTeam getOpposite(FightTeam fightTeam) {
|
||||
if (fightTeam == redTeam) {
|
||||
return blueTeam;
|
||||
} else if (fightTeam == blueTeam) {
|
||||
return redTeam;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException();
|
||||
return teamRegistry.opposite(fightTeam);
|
||||
}
|
||||
|
||||
public static FightPlayer getFightPlayer(LivingEntity player) {
|
||||
@@ -81,7 +66,11 @@ public class Fight {
|
||||
}
|
||||
|
||||
public static Collection<FightTeam> teams() {
|
||||
return teams;
|
||||
return teamRegistry.getTeams();
|
||||
}
|
||||
|
||||
public static boolean allTeamsReady() {
|
||||
return teamRegistry.allReady();
|
||||
}
|
||||
|
||||
public static FightTeam getUnrotated() {
|
||||
@@ -95,20 +84,14 @@ public class Fight {
|
||||
}
|
||||
|
||||
public static FightTeam getTeamByName(String name) {
|
||||
if (redTeam.getName().equalsIgnoreCase(name)) {
|
||||
return redTeam;
|
||||
}
|
||||
if (blueTeam.getName().equalsIgnoreCase(name)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
return teamRegistry.findById(name);
|
||||
}
|
||||
|
||||
public static boolean publicOnly() {
|
||||
if (Config.OnlyPublicSchematics) {
|
||||
return true;
|
||||
}
|
||||
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(GameConfig.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.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.gamecore.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.countdown.EnternCountdown;
|
||||
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
||||
import de.steamwar.sql.PersonalKit;
|
||||
|
||||
@@ -22,7 +22,8 @@ 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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
@@ -130,7 +131,7 @@ public class FightSchematic extends StateDependent {
|
||||
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
||||
}
|
||||
|
||||
if (ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
if (ArenaMode.AntiReplay.contains(GameConfig.mode)) {
|
||||
boolean changeRotation = false;
|
||||
if (Config.GameModeConfig.WinConditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||
changeRotation = new Random().nextBoolean();
|
||||
@@ -148,7 +149,7 @@ public class FightSchematic extends StateDependent {
|
||||
|
||||
private void replaceTeamColor(Clipboard clipboard) {
|
||||
try {
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(GameConfig.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor schematic", e);
|
||||
}
|
||||
@@ -173,7 +174,7 @@ public class FightSchematic extends StateDependent {
|
||||
);
|
||||
FightSystem.getHullHider().initialize(team);
|
||||
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
||||
if (ArenaMode.Check.contains(Config.mode) && !team.isBlue()) {
|
||||
if (ArenaMode.Check.contains(GameConfig.mode) && !team.isBlue()) {
|
||||
replaceSync(Material.TNT, Material.RED_WOOL);
|
||||
}
|
||||
|
||||
@@ -182,7 +183,7 @@ public class FightSchematic extends StateDependent {
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (Config.mode == ArenaMode.PREPARE) {
|
||||
if (GameConfig.mode == ArenaMode.PREPARE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,13 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.gamecore.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.events.TeamLeaveEvent;
|
||||
import de.steamwar.fightsystem.events.TeamSpawnEvent;
|
||||
import de.steamwar.fightsystem.listener.FightScoreboard;
|
||||
@@ -57,7 +58,7 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
public class FightTeam {
|
||||
public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntity> {
|
||||
|
||||
private static void setKitButton(HotbarKit kit, boolean leader) {
|
||||
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits) {
|
||||
@@ -79,14 +80,14 @@ public class FightTeam {
|
||||
static {
|
||||
setKitButton(notReadyKit, true);
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.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 (Config.test()) {
|
||||
if (GameConfig.test()) {
|
||||
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
@@ -163,7 +164,7 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
new OneShotStateDependent(ArenaMode.Restartable, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(GameConfig.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
||||
if (leader != null) leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
});
|
||||
@@ -236,7 +237,7 @@ public class FightTeam {
|
||||
|
||||
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), SteamwarUser.get(uuid), true));
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.mode) && isLeaderless()) {
|
||||
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
||||
Collections.shuffle(onlinePlayers);
|
||||
for (Player player : onlinePlayers) {
|
||||
@@ -338,7 +339,7 @@ public class FightTeam {
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, Fight.getOpposite(this).getExtendRegion());
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.mode)) {
|
||||
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +357,7 @@ public class FightTeam {
|
||||
this.leader = null;
|
||||
if (!players.isEmpty()) {
|
||||
setLeader(players.values().iterator().next(), false);
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(GameConfig.mode)) {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> FightState.setFightState(FightState.PRE_LEADER_SETUP), 1);
|
||||
}
|
||||
}
|
||||
@@ -404,6 +405,31 @@ public class FightTeam {
|
||||
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();
|
||||
}
|
||||
@@ -423,7 +449,7 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
private void testPasteAction() {
|
||||
if (Config.test()) {
|
||||
if (GameConfig.test()) {
|
||||
this.schematic.enable();
|
||||
} else if (Fight.getOpposite(this).schematic.hasSchematic()) {
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
@@ -455,7 +481,7 @@ public class FightTeam {
|
||||
if (ready) {
|
||||
broadcast("TEAM_READY");
|
||||
leader.ifPlayer(readyKit::loadToPlayer);
|
||||
if (Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode)) {
|
||||
if (Fight.allTeamsReady() || ArenaMode.SoloLeader.contains(GameConfig.mode)) {
|
||||
FightState.setFightState(FightState.PRE_RUNNING);
|
||||
}
|
||||
} else {
|
||||
@@ -468,10 +494,12 @@ public class FightTeam {
|
||||
this.skip = !skip;
|
||||
if (skip) {
|
||||
broadcast("SKIP_READY");
|
||||
if (Fight.getOpposite(this).skip || Config.test()) {
|
||||
if (Fight.getOpposite(this).skip || GameConfig.test()) {
|
||||
skip = false;
|
||||
Fight.getOpposite(this).skip = false;
|
||||
Countdown.skip();
|
||||
if (Countdown.skipActive()) {
|
||||
FightUI.addSubtitle("UI_SKIP");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast("SKIP_NOT_READY");
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
@@ -46,7 +47,7 @@ public class FightWorld extends StateDependent {
|
||||
private static final boolean PAPER = Bukkit.getVersion().contains("git-Paper");
|
||||
|
||||
public FightWorld() {
|
||||
super(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Schem);
|
||||
super(ArenaMode.Restartable.contains(GameConfig.mode) || GameConfig.replayserver(), FightState.Schem);
|
||||
register();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
||||
import de.steamwar.fightsystem.events.TeamLeaveEvent;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
@@ -51,7 +51,7 @@ public class Check implements Listener {
|
||||
|
||||
if (user.hasPerm(UserPerm.CHECK)) return;
|
||||
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
|
||||
if (user.getId() == schem.getOwner()) return;
|
||||
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.scoreboard.SWScoreboard;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
* 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
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -31,17 +32,16 @@ import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Dispenser;
|
||||
import org.bukkit.block.data.type.DriedGhast;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
@@ -86,7 +86,7 @@ public class Permanent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onTpGM3(PlayerTeleportEvent e) {
|
||||
if (ArenaMode.AntiTest.contains(Config.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
|
||||
if (ArenaMode.AntiTest.contains(GameConfig.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
|
||||
e.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_TELEPORT", e.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
e.getPlayer().kickPlayer(null);
|
||||
@@ -258,4 +258,16 @@ public class Permanent implements Listener {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", event.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents Dried Ghast from spawning and plants from growing
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockGrow(BlockGrowEvent event) {
|
||||
var type = event.getBlock().getType();
|
||||
|
||||
if (event.getBlock().getBlockData() instanceof DriedGhast || Tag.CROPS.isTagged(type) || Tag.SAPLINGS.isTagged(type)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -19,10 +19,11 @@
|
||||
|
||||
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;
|
||||
@@ -41,7 +42,7 @@ public class PistonListener implements Listener {
|
||||
|
||||
public PistonListener(Set<ArenaMode> condition, Consumer<BlockPistonEvent> leftAreaHandler) {
|
||||
this.leftAreaHandler = leftAreaHandler;
|
||||
if (!condition.contains(Config.mode)) return;
|
||||
if (!condition.contains(GameConfig.mode)) return;
|
||||
|
||||
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
|
||||
new StateDependentListener(!Config.GameModeConfig.Arena.AllowMissiles, FightState.All, this);
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -67,7 +68,7 @@ public class PrepareSchem implements Listener {
|
||||
|
||||
SchematicNode schem;
|
||||
try {
|
||||
schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
|
||||
schem = SchematicNode.getSchematicNode(GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
@@ -33,12 +34,12 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
public class Shutdown implements Listener {
|
||||
|
||||
public Shutdown() {
|
||||
new StateDependentListener(ArenaMode.AntiEvent.contains(Config.mode) && !Config.replayserver(), FightState.All, this);
|
||||
new StateDependentListener(ArenaMode.AntiEvent.contains(GameConfig.mode) && !GameConfig.replayserver(), FightState.All, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||
if (Config.replayserver() || Config.GameModeConfig.Arena.Leaveable) return;
|
||||
if (GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
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 (Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||
if (GameConfig.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.fightsystem.ArenaMode;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
@@ -72,6 +72,9 @@ public class WaterRemover implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntityType() == EntityType.WIND_CHARGE && !Config.GameModeConfig.Arena.WindchargesDestroyWater) {
|
||||
return;
|
||||
}
|
||||
event.setYield(0); //No drops (additionally to world config)
|
||||
|
||||
FightTeam spawn = tnt.remove(event.getEntity().getEntityId());
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
@Linked
|
||||
public class WindchargeInteractionDisabler implements Listener {
|
||||
|
||||
public WindchargeInteractionDisabler() {
|
||||
new StateDependentListener(!Config.GameModeConfig.Arena.WindchargesInteractWithBlocks, FightState.Running, this);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void handleEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntityType() != EntityType.WIND_CHARGE) return;
|
||||
event.blockList().clear();
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -23,14 +23,14 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.minecraft.world.entity.projectile.windcharge.WindCharge;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.WindCharge;
|
||||
|
||||
@Linked
|
||||
public class WindchargeStopper {
|
||||
|
||||
public WindchargeStopper() {
|
||||
new StateDependentTask(true, FightState.Running, this::run, 1, 1);
|
||||
new StateDependentTask(!Config.GameModeConfig.Arena.WindchargesCanCrossMiddle, FightState.Running, this::run, 1, 1);
|
||||
}
|
||||
|
||||
private static final int middleLine = Config.SpecSpawn.getBlockZ();
|
||||
@@ -39,13 +39,13 @@ public class WindchargeStopper {
|
||||
|
||||
private void run() {
|
||||
Recording.iterateOverEntities(windChargeClass::isInstance, entity -> {
|
||||
Location nextlocation = entity.getLocation().add(entity.getVelocity());
|
||||
Location location = entity.getLocation();
|
||||
Location prevLocation = location.clone().subtract(entity.getVelocity());
|
||||
|
||||
boolean passedMiddle = location.getBlockZ() > middleLine && prevLocation.getBlockZ() > middleLine ||
|
||||
location.getBlockZ() < middleLine && prevLocation.getBlockZ() < middleLine;
|
||||
boolean passedMiddle = nextlocation.getBlockZ() >= middleLine && location.getBlockZ() <= middleLine ||
|
||||
nextlocation.getBlockZ() <= middleLine && location.getBlockZ() >= middleLine;
|
||||
|
||||
if (!passedMiddle) {
|
||||
if (passedMiddle) {
|
||||
entity.remove();
|
||||
}
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user