diff --git a/src/main/java/fr/zelytra/daedalus/commands/godSummon/GodSummon.java b/src/main/java/fr/zelytra/daedalus/commands/godSummon/GodSummon.java index 17b42ad..846d20f 100644 --- a/src/main/java/fr/zelytra/daedalus/commands/godSummon/GodSummon.java +++ b/src/main/java/fr/zelytra/daedalus/commands/godSummon/GodSummon.java @@ -46,7 +46,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command Faction playerFaction; try { - playerFaction = Daedalus.getInstance().getGameManager().getFactionManager().getFactionOf(player); + playerFaction = Daedalus.getInstance().getGameManager().getFactionManager().getFactionOf(target); } catch (Exception exception) { exception.printStackTrace(); System.out.println("ERROR team not found"); diff --git a/src/main/java/fr/zelytra/daedalus/events/EventsManager.java b/src/main/java/fr/zelytra/daedalus/events/EventsManager.java index ae5728f..ca9847a 100644 --- a/src/main/java/fr/zelytra/daedalus/events/EventsManager.java +++ b/src/main/java/fr/zelytra/daedalus/events/EventsManager.java @@ -23,7 +23,6 @@ import fr.zelytra.daedalus.events.running.pvp.*; import fr.zelytra.daedalus.events.waiting.entities.EntityDamageListener; import fr.zelytra.daedalus.events.waiting.entities.EntityTargetListener; -import fr.zelytra.daedalus.events.waiting.environment.BlockPlaceListener; import fr.zelytra.daedalus.events.waiting.environment.JumpCheckPoint; import fr.zelytra.daedalus.events.waiting.gui.GameSettingsInterface; import fr.zelytra.daedalus.events.waiting.gui.TeamSelector; @@ -91,7 +90,6 @@ public static void registerEvents(Daedalus pl) { pm.registerEvents(new MinotaureHandler(), pl); /* Environment */ - pm.registerEvents(new BlockPlaceListener(), pl); pm.registerEvents(new JumpCheckPoint(), pl); pm.registerEvents(new TreeGrowthListener(), pl); pm.registerEvents(new MilkDrink(), pl); 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 123aaf1..7c6f09d 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 @@ -57,9 +57,11 @@ public void onCustomDeath(EntityDamageEvent e) { } } - if (e.getCause() == EntityDamageEvent.DamageCause.FALL && e.getEntity().getLastDamageCause() != null) { //Kill by falling - Player killer = (Player) ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager(); - killByAMino = daedalus.getGameManager().getFactionManager().getFactionOf(killer).getGodsEnum() == GodsEnum.MINOTAURE; //Tuer par un mino + if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { //Kill by falling + if ((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent) { + Player killer = (Player) ((EntityDamageByEntityEvent) e.getEntity().getLastDamageCause()).getDamager(); + killByAMino = daedalus.getGameManager().getFactionManager().getFactionOf(killer).getGodsEnum() == GodsEnum.MINOTAURE; //Tuer par un mino + } } boolean isMemberOfMino = daedalus.getGameManager().getFactionManager().getFactionOf(player).getGodsEnum() == GodsEnum.MINOTAURE;//Quand on est un mino @@ -113,7 +115,7 @@ private boolean isPVEDeath(EntityDamageEvent e) { if (projectileSource != null && projectileSource instanceof Player)//Shoot by a mob return false; - if(damageByEntityEvent.getDamager() instanceof Player) + if (damageByEntityEvent.getDamager() instanceof Player) return false; if (e.getCause() == EntityDamageEvent.DamageCause.FALL 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 ada08cc..4dde6d9 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 @@ -10,6 +10,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; @@ -67,6 +68,9 @@ public void onDefinitiveDeath(DefinitiveDeathEvent e) { for (PotionEffect effect : player.getActivePotionEffects()) player.removePotionEffect(effect.getType()); + player.getWorld().spawn(player.getLocation(), ExperienceOrb.class).setExperience((int) (player.getExp())); + player.setLevel(0); + player.setMaxHealth(20.0); deathFX(e.getEvent()); @@ -123,7 +127,7 @@ private void deathFX(EntityDamageEvent e) { return; } else if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { - if (e.getEntity().getLastDamageCause() == null) { + if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent)) { 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 a48099f..8b44aef 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(player.getTotalExperience()); + 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() == null) { + if (!((e.getEntity().getLastDamageCause()) instanceof EntityDamageByEntityEvent)) { Bukkit.broadcastMessage(faction.getType().getPrefix() + e.getEntity().getName() + GameSettings.LANG.textOf("death.default")); return; } diff --git a/src/main/java/fr/zelytra/daedalus/events/waiting/environment/BlockPlaceListener.java b/src/main/java/fr/zelytra/daedalus/events/waiting/environment/BlockPlaceListener.java deleted file mode 100644 index bcc8f0d..0000000 --- a/src/main/java/fr/zelytra/daedalus/events/waiting/environment/BlockPlaceListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.zelytra.daedalus.events.waiting.environment; - -import fr.zelytra.daedalus.Daedalus; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; - -public class BlockPlaceListener implements Listener { - - @EventHandler - public void onPlace(BlockPlaceEvent e){ - - if(Daedalus.getInstance().getGameManager().isWaiting()) - e.setCancelled(true); - - } -} diff --git a/src/main/java/fr/zelytra/daedalus/managers/guardian/Guardian.java b/src/main/java/fr/zelytra/daedalus/managers/guardian/Guardian.java index 2b1d8e7..9b26124 100644 --- a/src/main/java/fr/zelytra/daedalus/managers/guardian/Guardian.java +++ b/src/main/java/fr/zelytra/daedalus/managers/guardian/Guardian.java @@ -39,7 +39,7 @@ public class Guardian implements Listener { private final int health = 100; private final BossBar bossBar; - private final int respawnCooldown = 15;//600; //in seconds + private final int respawnCooldown = 600; //in seconds public Guardian(Location location) { this.spawnLoc = location; @@ -128,7 +128,6 @@ public void death() { this.bossBar.removeAll(); Bukkit.getScheduler().runTaskLater(Daedalus.getInstance(), () -> { - task = Bukkit.getScheduler().runTaskTimer(Daedalus.getInstance(), () -> { if (this.spawnLoc.isChunkLoaded()) { new Guardian(this.spawnLoc);