fix: add invulnerability flag to cached user in map, close #728

This commit is contained in:
William committed 2024-12-13 17:50:41 +00:00
1 parent 5d63899aff
commit 65aa93c3da
3 files changed
+8 -2

No files matched your search

@@ -167,7 +167,7 @@ public class FabricUser extends OnlineUser {
@Override
public boolean hasInvulnerability() {
return player.getCommandTags().contains(INVULNERABLE_TAG);
return markedAsInvulnerable || player.getCommandTags().contains(INVULNERABLE_TAG);
}
@Override
@@ -178,6 +178,7 @@ public class FabricUser extends OnlineUser {
}
player.setInvulnerable(true);
player.getCommandTags().add(INVULNERABLE_TAG);
markedAsInvulnerable = true;
plugin.runSyncDelayed(this::removeInvulnerabilityIfPermitted, this, invulnerableTicks);
}
@@ -187,6 +188,7 @@ public class FabricUser extends OnlineUser {
player.setInvulnerable(false);
}
player.removeCommandTag(INVULNERABLE_TAG);
markedAsInvulnerable = false;
}
@NotNull