GabiJunkes / MultipleBedSpawn

A simple Minecraft plugin to allow players to choose which bed to respawn into.
GNU General Public License v3.0
9 stars 3 forks source link

One Player can't use bed spawns #7

Closed slayer6409 closed 1 year ago

slayer6409 commented 1 year ago

This is the error

Dasphertin was shot by Skeleton [05:04:15] [Server thread/ERROR]: Could not pass event PlayerRespawnEvent to MultipleBedSpawn v1.4 java.lang.NullPointerException: Cannot invoke "String.equalsIgnoreCase(String)" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null at me.gabrielfj.multiplebedspawn.utils.BedsUtils.checksIfBedExists(BedsUtils.java:71) ~[MultipleBedSpawn-1.4.jar:?] at me.gabrielfj.multiplebedspawn.listeners.PlayerRespawnListener.lambda$onPlayerRespawn$1(PlayerRespawnListener.java:56) ~[MultipleBedSpawn-1.4.jar:?] at java.util.HashMap.forEach(HashMap.java:1429) ~[?:?] at me.gabrielfj.multiplebedspawn.listeners.PlayerRespawnListener.onPlayerRespawn(PlayerRespawnListener.java:53) ~[MultipleBedSpawn-1.4.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor30.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:git-Paper-409] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.19.3.jar:git-Paper-409] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.19.3.jar:git-Paper-409] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?] at net.minecraft.server.players.PlayerList.respawn(PlayerList.java:870) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.players.PlayerList.respawn(PlayerList.java:773) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.players.PlayerList.respawn(PlayerList.java:768) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleClientCommand(ServerGamePacketListenerImpl.java:2906) ~[?:?] at net.minecraft.network.protocol.game.ServerboundClientCommandPacket.handle(ServerboundClientCommandPacket.java:24) ~[?:?] at net.minecraft.network.protocol.game.ServerboundClientCommandPacket.a(ServerboundClientCommandPacket.java:10) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.3.jar:git-Paper-409] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-409] at java.lang.Thread.run(Thread.java:1589) ~[?:?]

GabiJunkes commented 1 year ago

I am looking at it, I will be trying to reproduce it. Is it only one specific player? Did it always not work for them, or did it started giving error after some time? The more information the better, thank you for the error log :)

GabiJunkes commented 1 year ago

I think I found the problem, it has to do with registering a bed, breaking it and replacing it in the exact place without registering again. The plugin tries to access data stored in the new bed but fails. I am working on the fix, should be easy.

GabiJunkes commented 1 year ago

Should be fixed at V1.4.1. If not, you can open another issue or reopen this one :)