Skip to content

Commit

Permalink
Fix some things
Browse files Browse the repository at this point in the history
  • Loading branch information
zelytra committed Sep 11, 2021
1 parent cfe97b0 commit 3d5d4cb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/fr/zelytra/daedalus/events/EventsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3d5d4cb

Please sign in to comment.