PaperMC / PaperMC/Paper

Player desync with server after death

Open
#13,451 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

That shouldn't happen

Observed/Actual behavior

Player client side can do anything, but server side they are just standing there with invulnerability and can't be moved. Kill doesn't work, teleport does work, seems like they are in a state of dead and living.

Steps/models to reproduce

I enabled immediate respawn
below is what I do to players at the time they die in EntityDeathEvent

private void applyLevelEffects(Player player, int lvl) {
        player.getInventory().clear();
        player.getInventory().addItem(getWeapon(lvl));

        addOrReplaceAttribute(player, Attribute.MAX_HEALTH,
                "battle_health_" + lvl, 10);

        addOrReplaceAttribute(player, Attribute.SCALE,
                "battle_scale_" + lvl, 0.25);

        addOrReplaceAttribute(player, Attribute.ARMOR,
                "battle_armor_" + lvl, 5);

        player.setHealth(player.getAttribute(Attribute.MAX_HEALTH).getValue());
    }
private void addOrReplaceAttribute(Player player,
                                       Attribute attribute,
                                       String key,
                                       double amount) {

        var attr = player.getAttribute(attribute);
        if (attr == null) return;

        NamespacedKey nsKey = NamespacedKey.minecraft(key);

        attr.getModifiers().stream()
                .filter(m -> m.getKey().equals(nsKey))
                .forEach(attr::removeModifier);

        attr.addModifier(new AttributeModifier(
                nsKey,
                amount,
                AttributeModifier.Operation.ADD_NUMBER
        ));
    }

I don't know which part triggers the desync, maybe attribute part

Plugin and Datapack List

Luckperms, multiverse, nochatreports, packetevents, PlaceholderAPI, PlugmanX and the test plugin

Paper version

paper 1.21.11-62

Other

For now I delayed the action for 4 ticks and it works fine

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Paper 1.21.11-62 with immediate respawn and the EntityDeathEvent handler shown in the report. Compare immediate execution with the reported four-tick delay, then narrow down the desynchronized state; done means the player remains synchronized without requiring that delay.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.