📜  playerdamagebyentityevent - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:04.938000             🧑  作者: Mango

代码示例1
@EventHandler
public void onPlayerDamage(EntityDamageByEntityEvent e) {
Entity damager = e.getDamager();
Entity damageTaker = e.getEntity();

if (damageTaker instanceof Player) {
    //DamageTaker is a Player
    Player taker = (Player) damageTaker;
    if (damager instanceof Player) {
        //Damage Causer is also a player
        Player damagerPlayer = (Player) damager;
    }
}