DaFuqs / GlobalSpawn

GlobalSpawn allows you to change spawn dimension and position via command or config file.
GNU Lesser General Public License v3.0
4 stars 3 forks source link

[BUG] Setting initial spawn and global spawn point makes players unable to respawn after death (1.18.2) #11

Closed MrRubberDucky closed 2 years ago

MrRubberDucky commented 2 years ago

Describe the bug Setting a Iniital spawn and Global spawn ends up making players unable to respawn (Respawn button does nothing but console gets spammed with errors) or if player's data is removed, player is unable to join the server again due to getting disconnected due to Invalid Player Data until config for GlobalSpawn gets removed.

To Reproduce Set initial spawn somewhere with /initialspawnpoint set and then set a global spawn somewhere with /globalspawnpoint set, then kill yourself and try to respawn

Expected behavior Player gets correctly respawned at Global spawn point

Screenshots Too lazy for screenshots but here are some logs:

[18:43:43] [Server thread/ERROR]: Failed to handle packet net.minecraft.class_2799@1fbad116, suppressing error
java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2960.toString()" because "$$0" is null
    at Not Enough Crashes deobfuscated stack trace.(1.18.1+build.22) ~[?:?]
    at net.minecraft.stat.Stat.getName(Stat:29) ~[?:?]
    at net.minecraft.stat.Stat.getName(Stat:23) ~[?:?]
    at net.minecraft.stat.Stat.<init>(Stat:16) ~[?:?]
    at net.minecraft.stat.StatType.method_14961(StatType:28) ~[?:?]
    at java.util.Map.computeIfAbsent(Map.java:1054) ~[?:?]
    at net.minecraft.stat.StatType.getOrCreateStat(StatType:28) ~[?:?]
    at net.minecraft.stat.StatType.getOrCreateStat(StatType:41) ~[?:?]
    at de.dafuqs.globalspawn.GlobalSpawnMixinHandler.isNewPlayer(GlobalSpawnMixinHandler.java:106) ~[globalspawn-1.5.0-1.18.2.jar:?]
    at de.dafuqs.globalspawn.GlobalSpawnMixinHandler.movePlayerToSpawn(GlobalSpawnMixinHandler.java:90) ~[globalspawn-1.5.0-1.18.2.jar:?]
    at net.minecraft.server.network.ServerPlayerEntity.handler$chj000$moveToSpawn(ServerPlayerEntity:13263) ~[?:?]
    at net.minecraft.server.network.ServerPlayerEntity.moveToSpawn(ServerPlayerEntity) ~[?:?]
    at net.minecraft.server.PlayerManager.handler$eda000$moveToSpawn(PlayerManager:13485) ~[?:?]
    at net.minecraft.server.PlayerManager.respawnPlayer(PlayerManager:479) ~[?:?]
    at net.minecraft.server.network.ServerPlayNetworkHandler.onClientStatus(ServerPlayNetworkHandler:1391) ~[?:?]
    at net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket.apply(ClientStatusC2SPacket:24) ~[?:?]
    at net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket.apply(ClientStatusC2SPacket:6) ~[?:?]
    at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils:22) ~[?:?]
    at net.minecraft.server.ServerTask.run(ServerTask:18) ~[?:?]
    at net.minecraft.util.thread.ThreadExecutor.redirect$zie000$redirectExecuteTask(ThreadExecutor:521) ~[?:?]
    at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor:131) ~[?:?]
    at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer:12990) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.runTask(MinecraftServer:784) ~[server-intermediary.jar:?]
    at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor:140) ~[?:?]
    at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer:769) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.handler$zmb000$modifiedRunLoop(MinecraftServer:4405) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer:676) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer:273) ~[server-intermediary.jar:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]
[18:43:44] [Server thread/INFO]: [STDOUT]: Skipping minecraft:player

Tested on my server with mods + PolyMC and a instance with just Cloth Config 6.2.57, GlobalSpawn, Polydex, Polymer, Fabric API and PolyMC, the result was the same for both, and Minecraft 1.18.2

DaFuqs commented 2 years ago

Fixed in version 1.5.1. Ty for reporting!