Minecraftmc259
让玩家不可以攻击怪物的 doc方法在那里?

602723113
恩...没听懂你的意思其实qwq
  1. @EventHandler
  2. public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
  3.     if(e.getDamager() instanceof Player) {
  4.        if(e.getEntity() instanceof Monsters) {
  5.           e.setCancelled(true);
  6.        }
  7.     }
  8. }
复制代码