stargate-rewritten / Stargate-Bukkit

The original, and still the best, survival-friendly portal plugin.
https://sgrewritten.org/paper
GNU Lesser General Public License v3.0
33 stars 12 forks source link

Adding unregistered flags to portals causes problems #368

Closed Pheotis closed 5 months ago

Pheotis commented 5 months ago

Bug Description

Internal flags (i.e. numbers) shouldn't be addable to portals. Doing so causes problems?

Reproduction Steps

portal

network
0

Desired Behaviour

This shouldn't be possible, and should be handled accordingly.

Observed Behaviour

[Stargate] Adding flag 0 to portal: org.sgrewritten.stargate.network.portal.StargatePortal@3e879181
[22:44:25 WARN]: [Stargate] org.sgrewritten.stargate.exception.database.StorageWriteException: java.sql.SQLIntegrityConstraintViolationException: Column 'flag' cannot be null
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.database.SQLDatabase.savePortalToStorage(SQLDatabase.java:166)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.network.StargateNetworkManager$3.run(StargateNetworkManager.java:254)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateTask.runTask(StargateTask.java:101)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask.lambda$runNow$0(StargateQueuedAsyncTask.java:30)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask.cycleThroughAsyncQueue(StargateQueuedAsyncTask.java:75)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask$3.run(StargateQueuedAsyncTask.java:66)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateTask.runTask(StargateTask.java:101)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateAsyncTask.lambda$runNow$1(StargateAsyncTask.java:21)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateBukkitRunnable.run(StargateBukkitRunnable.java:13)
         at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:101)
         at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
         at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
         at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.sql.SQLIntegrityConstraintViolationException: Column 'flag' cannot be null
         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
         at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
         at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:912)
         at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.database.SQLDatabase.addFlag(SQLDatabase.java:448)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.database.SQLDatabase.addFlags(SQLDatabase.java:439)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.database.SQLDatabase.savePortalToStorage(SQLDatabase.java:143)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.network.StargateNetworkManager$3.run(StargateNetworkManager.java:254)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateTask.runTask(StargateTask.java:101)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask.lambda$runNow$0(StargateQueuedAsyncTask.java:30)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask.cycleThroughAsyncQueue(StargateQueuedAsyncTask.java:75)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateQueuedAsyncTask$3.run(StargateQueuedAsyncTask.java:66)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateTask.runTask(StargateTask.java:101)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateAsyncTask.lambda$runNow$1(StargateAsyncTask.java:21)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.thread.task.StargateBukkitRunnable.run(StargateBukkitRunnable.java:13)
         at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:101)
         at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
         at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
         at java.base/java.lang.Thread.run(Thread.java:1583)

Trace Logs

No response

Other Information

No response

Thorinwasher commented 5 months ago

0 is not an internal flag at the moment, still needs to be fixed