CatServer icon indicating copy to clipboard operation
CatServer copied to clipboard

[1.16.5] PlayerDeathEvent does not return data about the player's inventory

Open Flareonn opened this issue 2 years ago • 2 comments

Environment

Minecraft version 1.16.5: Mods/Plugins: image

Describe the bug During the PlayerDeathEvent, data about the player is sent to the method. Players inventory is available, but the inventory turns out to be empty.

Screenshot/Video image

Null comes in this line, although there was an item in this slot at the time of death

Flareonn avatar May 26 '22 19:05 Flareonn

These operations occur due to the fact that the standard two lines for saving inventory do not work.

event.setKeepInventory(true)
event.getDrops().clear()

Flareonn avatar May 26 '22 19:05 Flareonn

There is also a question: is there any API for accessing the core so that I can get the player's inventory from there?

Flareonn avatar May 26 '22 20:05 Flareonn

EntityDamageByEntityEvent & EntityDamageEvent & PlayerDeathEvent - broken/not working. My code:

@EventHandler
public void onDamage1(EntityDamageEvent e) {
	Bukkit.getConsoleSender().sendMessage("EntityDamageEvent");
}

@EventHandler
public void onDamage2(EntityDamageByEntityEvent e) {
	Bukkit.getConsoleSender().sendMessage("EntityDamageByEntityEvent");
}

@EventHandler
public void onDeath(PlayerDeathEvent e) {
	ItemStack item = e.getEntity().getInventory().getItemInMainHand();
	String name = "PlayerDeathEvent: ";
	Bukkit.getConsoleSender().sendMessage(item == null ? name + "NULL" : name + item.getType().name());
}

dayd21git avatar May 19 '23 19:05 dayd21git

a year later, they finally fixed this bug, we've been waiting for this for a long time

Serega007RU avatar May 21 '23 06:05 Serega007RU

a year later, they finally fixed this bug, we've been waiting for this for a long time

This is a good start, indicating that we are focusing on developing 1.16.5

Kotori0629 avatar May 21 '23 06:05 Kotori0629