NPE whilst traversing End Portal
LB45440078L opened this issue ยท 1 comments
WorldEdit Version
7.3.4
WorldGuard Version
7.0.11-beta1
Platform Version
Purpur Version 1.21-2273-61b63b1 (MC: 1.21)
Confirmations
- I am using the most recent Minecraft release.
- I am using a version of WorldEdit compatible with my Minecraft version.
- I am using a version of WorldGuard compatible with my Minecraft version.
- I am using the latest or recommended version of my platform software.
- I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
- I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
Bug Description
A NullPointerException can always be encountered whilst touching a end portal block on a server with end world disabled through allow-end: false.
Click to open crash logs
[17:04:55 ERROR]: Could not pass event PlayerTeleportEvent to WorldGuard v7.0.11-beta1+a801a9d
java.lang.NullPointerException: null
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:903) ~[guava-32.1.2-jre.jar:?]
at worldedit-bukkit-7.3.4.jar/com.sk89q.worldedit.bukkit.BukkitAdapter.adapt(BukkitAdapter.java:224) ~[worldedit-bukkit-7.3.4.jar:?]
at worldguard-bukkit-7.0.11-beta1-dist.jar/com.sk89q.worldguard.bukkit.listener.WorldGuardPlayerListener.onPlayerTeleport(WorldGuardPlayerListener.java:361) ~[worldguard-bukkit-7.0.11-beta1-dist.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor13.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:1.21-2273-61b63b1]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.level.ServerPlayer.changeDimension(ServerPlayer.java:1413) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.Entity.handlePortal(Entity.java:3326) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.Entity.baseTick(Entity.java:898) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.LivingEntity.baseTick(LivingEntity.java:447) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.Entity.tick(Entity.java:871) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.LivingEntity.tick(LivingEntity.java:3200) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.world.entity.player.Player.tick(Player.java:317) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.level.ServerPlayer.doTick(ServerPlayer.java:854) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.network.ServerGamePacketListenerImpl.tick(ServerGamePacketListenerImpl.java:360) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.network.Connection.tick(Connection.java:647) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:242) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1859) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:509) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1633) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1333) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:333) ~[purpur-1.21.jar:1.21-2273-61b63b1]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Expected Behavior
The expected behaviour would be that nothing at all happens.
The teleport should not happen and that does not represent an issue because the end world is disabled.
Reproduction Steps
Using Paper 1.21:
- Set "allow-end: true" from bukkit.yml.
- Start the Server with the latest version of WorldEdit and WorldGuard
- Put a few end portals on the ground with //set end_portal
- Try entering the portal, an NPE will be thrown.
Optional WorldGuard-Report
No response
Anything Else?
When a player goes through a portal in a server without end world, the server still calls the PlayerTeleportEvent event, however with a null destination location.
Given that WorldGuard constantly listens to such events, and passes them to software such as WorldEdit, which must require a non-null location, I suggest rewriting the logic of your software so that teleport events with null destinations get ignored instead of channeling down and ending in a null check precondition.
The null location in such event is an expected and known behaviour, so it is on WorldGuard\WorldEdit to fix this.
Duplicate of #2111