CatServer
CatServer copied to clipboard
[1.16.5] PlayerDeathEvent does not return data about the player's inventory
Environment
Minecraft version 1.16.5:
Mods/Plugins:
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
Null comes in this line, although there was an item in this slot at the time of death
These operations occur due to the fact that the standard two lines for saving inventory do not work.
event.setKeepInventory(true)
event.getDrops().clear()
There is also a question: is there any API for accessing the core so that I can get the player's inventory from there?
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());
}
a year later, they finally fixed this bug, we've been waiting for this for a long time
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