Stargate Rewritten

Stargate Rewritten

241 Downloads

NullpointerException when using bungee gate with invalid destination portal

Thorinwasher opened this issue ยท 5 comments

commented

how to replicate:

  • Create A portal with the following format
portalname
invalidDestinationName
validServerName
u
  • Then go through it. no player should be on the server the player is connecting to

Stacktrace:

java.lang.NullPointerException: Cannot invoke "net.TheDgtl.Stargate.network.Network.getPortal(String)" because "network" is null
        at net.TheDgtl.Stargate.listener.StargateBungeePluginMessageListener.legacyPlayerConnect(StargateBungeePluginMessageListener.java:153) ~[?:?]
        at net.TheDgtl.Stargate.listener.StargateBungeePluginMessageListener.onPluginMessageReceived(StargateBungeePluginMessageListener.java:117) ~[?:?]
        at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2776) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.network.protocol.game.PacketPlayInCustomPayload.a(SourceFile:38) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.network.protocol.game.PacketPlayInCustomPayload.a(SourceFile:7) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1190) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:131) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.be(MinecraftServer.java:1169) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1162) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:140) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1146) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1051) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3491-Spigot-b081915-95d233d]
        at java.lang.Thread.run(Thread.java:833) [?:?]
commented

Is an invalid destination portal relevant? The error doesn't seem related to the portal name, but rather to the LegacyBungee network being unavailable in some way.
Are both servers on the newest version? As we changed some stuff regarding the LegacyBungee network, I don't think different rewrite versions are fully compatible.

This line returns null: Network network = Stargate.getRegistryStatic().getNetwork(bungeeNetwork, false); when using the legacy network defined in BungeePortal.

The problem seems to be that the LegacyBungee network is used before the network is created (on the target server). Therefore, getNetwork returns null.

commented

That's true, but the portal returned will still be null, so 32fda8e does not fix the issue yet, as another nullpointer exception will be at line 161

destinationPortal.teleportHere(player, null);
commented

That's true, but the portal returned will still be null, so 32fda8e does not fix the issue yet, as another nullpointer exception will be at line 161

destinationPortal.teleportHere(player, null);

Oh, as you only mentioned a problem that was not what the stack trace told me, I though you'd mis-understood the problem, not that there were two unrelated problems in the same method.

commented

Sorry for not being clear sometimes

commented

Tested