#Player respawn location issue and invisibility bug

1 messages · Page 1 of 1 (latest)

frank mulch
#

📋 Bug Description
When a player dies and respawns, two issues occur simultaneously:

  1. Incorrect Respawn Location: The player respawns at an unintended location instead of the set worldspawn.
  2. Desync / Invisibility Bug: The respawned player is invisible to other players. (Note: Moving to another world and coming back fixes the invisibility, but this needs to be fixed properly.)

🔄 Steps to Reproduce

  1. A player dies in-game.
  2. The player clicks the respawn button.
  3. Observe that the player spawns at the wrong location.
  4. Check from another player's perspective that the respawned player is not visible.
  5. (Workaround check) When the respawned player travels to another world and returns, the character renders normally again.

💡 Expected Behavior

  • Players should respawn at the correct worldspawn location after dying.
  • The player's position and rendering should be immediately synchronized for all players upon respawn, without requiring a world change workaround.

🖥️ Environment

GitHub

📦 PowerNukkitX 3.0.0

PowerNukkitX Version
3.0.0

API Version
3.0.0

Protocol Version
1001

broken sun
#

It’s also happening with me

#

I can’t add that the invisible player can break, place, hurt other players

broken sun
cerulean kraken
#

didn't i say about this bug months ago

#

like over 7 months ago?

frank mulch
cerulean kraken
#

it's not my fault if they decide not to fix things

frank mulch
cerulean kraken
#

you said you're

#

anyway whatever

frank mulch
cerulean kraken
#

not sure they could reproduce it anyway

frank mulch
#

Frankly, it seems like PNX's maintainers are only trying to implement vanilla and not trying to solve the fundamental problems. It might be right to manage PNX in a personal fork.

mellow cobalt
#

I thought we fixed this thosewhoknow

#

I'll look into it later today if no other maintainer patches it earlier

mellow cobalt
frank mulch
#
@EventHandler(priority = EventPriority.LOWEST)
fun onPlayerRespawnEvent(event: PlayerRespawnEvent) {
    val player = event.player
    val world = player.level
    if (world.players.size <= 1) return
    player.waitForAck {
        player.teleport(world.spawnLocation.add(0.5, 0.0, 0.5))
        var ticks = 0
        val task = object : Runnable {
            override fun run() {
                player.spawnToAll()
                ticks += 5
                if (ticks < 100) {
                    world.server.scheduler.scheduleDelayedTask(this@RespawnVisibilityFixerPlugin, this, 5)
                }
            }
        }
        world.server.scheduler.scheduleDelayedTask(this, task, 1)
    }
}
frank mulch
#

@mellow cobalt
I think it would be better to check if the value of the getSpawnLocation method is safe before returning a position with the getSafeSpawn method, and return getSpawnLocation directly if it is already safe.

The current problem with the getSafeSpawn method is that it immediately tries to find a safe position (by running the search logic) before even checking whether getSpawnLocation is safe or not.

mellow cobalt