From f4413050543fb93aaa24d706c101d2b58e994b90 Mon Sep 17 00:00:00 2001 From: zelytra Date: Sun, 12 Sep 2021 12:33:03 +0200 Subject: [PATCH] Some fix --- .../running/players/DeathHandler/listener/DeathListener.java | 2 +- .../DeathHandler/listener/DefinitiveDeathListener.java | 2 +- .../players/DeathHandler/listener/PartielDeathListener.java | 4 ++-- .../daedalus/events/running/players/PlayerDropListener.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DeathListener.java b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DeathListener.java index 7c6f09d..1b42c5c 100644 --- a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DeathListener.java +++ b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DeathListener.java @@ -58,7 +58,7 @@ public void onCustomDeath(EntityDamageEvent e) { } if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { //Kill by falling - if ((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent) { + if ((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent && ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager() instanceof Player) { Player killer = (Player) ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager(); killByAMino = daedalus.getGameManager().getFactionManager().getFactionOf(killer).getGodsEnum() == GodsEnum.MINOTAURE; //Tuer par un mino } diff --git a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DefinitiveDeathListener.java b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DefinitiveDeathListener.java index 4dde6d9..5cd80ec 100644 --- a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DefinitiveDeathListener.java +++ b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/DefinitiveDeathListener.java @@ -127,7 +127,7 @@ private void deathFX(EntityDamageEvent e) { return; } else if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { - if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent)) { + if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent)&& ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager() instanceof Player) { Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() + GameSettings.LANG.textOf("death.definitive")); return; } diff --git a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/PartielDeathListener.java b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/PartielDeathListener.java index 8b44aef..336915a 100644 --- a/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/PartielDeathListener.java +++ b/src/main/java/fr/zelytra/daedalus/events/running/players/DeathHandler/listener/PartielDeathListener.java @@ -69,7 +69,7 @@ public void onPartielDeath(PartielDeathEvent e) { player.setSaturation(20.0f); - player.getWorld().spawn(player.getLocation(), ExperienceOrb.class).setExperience((int) (player.getExp()/4.0)); + player.getWorld().spawn(player.getLocation(), ExperienceOrb.class).setExperience((int) (player.getExp() / 4.0)); player.setLevel(0); player.getInventory().clear(); @@ -139,7 +139,7 @@ private void respawnFX(EntityDamageEvent e) { return; } else if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { - if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent)) { + if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent) && ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager() instanceof Player) { Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() + GameSettings.LANG.textOf("death.default")); return; } diff --git a/src/main/java/fr/zelytra/daedalus/events/running/players/PlayerDropListener.java b/src/main/java/fr/zelytra/daedalus/events/running/players/PlayerDropListener.java index ae20803..8ce117b 100644 --- a/src/main/java/fr/zelytra/daedalus/events/running/players/PlayerDropListener.java +++ b/src/main/java/fr/zelytra/daedalus/events/running/players/PlayerDropListener.java @@ -55,7 +55,7 @@ public void onItemMove(InventoryClickEvent e) { if (e.getWhoClicked().getGameMode() != GameMode.SURVIVAL) return; - if (e.getWhoClicked().getOpenInventory().getType() == InventoryType.CRAFTING) return; + if (e.getWhoClicked().getOpenInventory().getType() == InventoryType.CRAFTING || e.getWhoClicked().getOpenInventory().getType() == InventoryType.ANVIL) return; if (e.getCurrentItem() == null) return;