mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-27 06:03:01 +02:00
fix: correctly refresh client state on death
This commit is contained in:
parent
9ed8605edc
commit
77df1bdfd2
@ -73,6 +73,7 @@ public class Main {
|
||||
commandManager.register(new SidebarCommand());
|
||||
commandManager.register(new SetEntityType());
|
||||
commandManager.register(new RelightCommand());
|
||||
commandManager.register(new KillCommand());
|
||||
|
||||
commandManager.setUnknownCommandCallback((sender, command) -> sender.sendMessage(Component.text("Unknown command", NamedTextColor.RED)));
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package net.minestom.demo.commands;
|
||||
|
||||
import net.minestom.server.command.builder.Command;
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
public class KillCommand extends Command {
|
||||
public KillCommand() {
|
||||
super("kill");
|
||||
|
||||
setDefaultExecutor((sender, context) -> {
|
||||
if (sender instanceof Player player) {
|
||||
player.kill();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -519,10 +519,10 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
|
||||
sendPacket(new RespawnPacket(getDimensionType().toString(), instance.getDimensionName(),
|
||||
0, gameMode, gameMode, false, levelFlat, deathLocation, portalCooldown, RespawnPacket.COPY_ALL));
|
||||
refreshClientStateAfterRespawn();
|
||||
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(this);
|
||||
EventDispatcher.call(respawnEvent);
|
||||
triggerStatus((byte) (24 + permissionLevel)); // Set permission level
|
||||
refreshIsDead(false);
|
||||
updatePose();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user