Stargate Rewritten

Stargate Rewritten

241 Downloads

Plugin crashes when migrating invalid gate file present in world.

Pheotis opened this issue ยท 1 comments

commented

Bug Description

If a gate with an invalid gatefile is present in legacy, the migrator will lead to a crash in the rewrite.

Reproduction Steps

  1. In the latest legacy, tested on spigot 1.17.1, create a custom gatefile such as this:
portal-open=NETHER_PORTAL
portal-closed=AIR
button=STONE_BUTTON
toowner=false
X=STONE
-=STONE

 XX 
X..X
-..-
X*.X
 XX 
  1. Build a portal with that gate format.
  2. Stop the server.
  3. Change the gatefile to be invalid (tested by removing the entrance indicator)
portal-open=NETHER_PORTAL
portal-closed=AIR
button=STONE_BUTTON
toowner=false
X=STONE
-=STONE

 XX 
X..X
-..-
X..X
 XX 
  1. Swap out the server's jar with the latest paper, swap out the legacy jar with the latest rewrite.
  2. Start the server.

Desired Behaviour

Either the gates with this format should fail to load, or perhaps they should be fixed somehow, possibly by adding the entrance at a random traversable block.

Observed Behaviour

[INFO]: [Stargate] Enabling Stargate v1.0.0.16-NIGHTLY-3
[WARN]: [Stargate] Could not load Gate broken.gate - Design is missing an exit
[INFO]: [Stargate] Running database migration 0.11.5.5 -> 1.0.0.11
[INFO]: [Stargate] Created network with id: <@default@>
[INFO]: [Stargate] fetched networkName: <@default@>
[INFO]: [Stargate] fetched networkName: <@default@>
[WARN]: [Stargate] Could not find the format ''broken.gate''. Check the full startup log for more information
[ERROR]: Error occurred while enabling Stargate v1.0.0.16-NIGHTLY-3 (Is it up to date?)
java.lang.IllegalArgumentException: Could not find gate format
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.util.database.PortalStorageHelper.loadPortalData(PortalStorageHelper.java:157) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.util.LegacyPortalStorageLoader.readPortal(LegacyPortalStorageLoader.java:99) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.util.LegacyPortalStorageLoader.loadPortalsFromStorage(LegacyPortalStorageLoader.java:79) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.migration.DataMigration6.migratePortals(DataMigration6.java:157) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.migration.DataMigration6.run(DataMigration6.java:98) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.migration.DataMigrator.run(DataMigrator.java:97) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.Stargate.migrateConfigurationAndData(Stargate.java:354) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at Stargate-1.0.0.16-NIGHTLY-3.jar/org.sgrewritten.stargate.Stargate.onEnable(Stargate.java:154) ~[Stargate-1.0.0.16-NIGHTLY-3.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:519) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:604) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:675) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1136) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-128-3181470]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
[INFO]: [Stargate] Disabling Stargate v1.0.0.16-NIGHTLY-3

Trace Logs

Tested on windows, spigot 1.17.1, and the latest paper 1.20.6.
Tested with legacy 0.11.5.9 and nightly 3 of the rewrite.

Other Information

No response

commented

This no longer crashes, but does still print a warning.
This stack trace should probably be suppressed and replaced with a more descriptive console error.
Something like "A gate was found in the world with an invalid gateformat. Gates {names} were not loaded"

[WARN]: [Stargate] Could not find the format ''broken.gate''. Check the full startup log for more information
[WARN]: [Stargate] java.lang.IllegalArgumentException: Could not find gate format
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.util.database.PortalStorageHelper.loadPortalData(PortalStorageHelper.java:157)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.util.LegacyPortalStorageLoader.readPortal(LegacyPortalStorageLoader.java:103)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.util.LegacyPortalStorageLoader.loadPortalsFromStorage(LegacyPortalStorageLoader.java:80)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.migration.DataMigration6.migratePortals(DataMigration6.java:157)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.migration.DataMigration6.run(DataMigration6.java:98)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.migration.DataMigrator.run(DataMigrator.java:97)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.Stargate.migrateConfigurationAndData(Stargate.java:354)
         at Stargate-1.0.0.16-NIGHTLY-3.jar//org.sgrewritten.stargate.Stargate.onEnable(Stargate.java:154)
         at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287)
         at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202)
         at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109)
         at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:519)
         at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:604)
         at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:553)
         at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:675)
         at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437)
         at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323)
         at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1136)
         at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323)
         at java.base/java.lang.Thread.run(Thread.java:1583)