From f0e99674c65d80e79c1b1414ba2b3c9df6a83b32 Mon Sep 17 00:00:00 2001 From: ProSavage Date: Mon, 23 Jul 2018 12:00:01 -0500 Subject: [PATCH] Moved one of the checks in Exp Upgrade up to improve performance --- .../factions/zcore/fupgrades/EXPUpgrade.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java index cc50c7ce..dadd86ce 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java @@ -11,15 +11,15 @@ import org.bukkit.event.entity.EntityDeathEvent; public class EXPUpgrade implements Listener { @EventHandler public void onDeath(EntityDeathEvent e) { - Location loc = e.getEntity().getLocation(); - Faction wild = Factions.getInstance().getWilderness(); - FLocation floc = new FLocation(loc); - Faction faction = Board.getInstance().getFactionAt(floc); Entity killer = e.getEntity().getKiller(); Player player = (Player) killer; if (player == null) { return; } + Location loc = e.getEntity().getLocation(); + Faction wild = Factions.getInstance().getWilderness(); + FLocation floc = new FLocation(loc); + Faction faction = Board.getInstance().getFactionAt(floc); if (faction != wild) { int level = faction.getUpgrade("Exp"); if (level != 0) { @@ -35,12 +35,11 @@ public class EXPUpgrade implements Listener { double multiplier = P.p.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); spawnMoreExp(e, multiplier); } - } } } - public void spawnMoreExp(EntityDeathEvent e, double multiplier) { + private void spawnMoreExp(EntityDeathEvent e, double multiplier) { double newExp = e.getDroppedExp() * multiplier; int newExpInt = (int) newExp; e.setDroppedExp(newExpInt);