Luohuayu / CatServer

高性能和高兼容性的1.12.2/1.16.5/1.18.2版本Forge+Bukkit+Spigot服务端 (A high performance and high compatibility 1.12.2/1.16.5/1.18.2 version Forge+Bukkit+Spigot server)
https://catmc.org
GNU Lesser General Public License v3.0
1.98k stars 211 forks source link

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

Closed Flareonn closed 1 year ago

Flareonn commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

dayd21git commented 1 year ago

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());
}
Serega007RU commented 1 year ago

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

Kotori0629 commented 1 year ago

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