Moved one of the checks in Exp Upgrade up to improve performance
This commit is contained in:
parent
6a1072b935
commit
f0e99674c6
@ -11,15 +11,15 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
|||||||
public class EXPUpgrade implements Listener {
|
public class EXPUpgrade implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(EntityDeathEvent e) {
|
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();
|
Entity killer = e.getEntity().getKiller();
|
||||||
Player player = (Player) killer;
|
Player player = (Player) killer;
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
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) {
|
if (faction != wild) {
|
||||||
int level = faction.getUpgrade("Exp");
|
int level = faction.getUpgrade("Exp");
|
||||||
if (level != 0) {
|
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");
|
double multiplier = P.p.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3");
|
||||||
spawnMoreExp(e, multiplier);
|
spawnMoreExp(e, multiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnMoreExp(EntityDeathEvent e, double multiplier) {
|
private void spawnMoreExp(EntityDeathEvent e, double multiplier) {
|
||||||
double newExp = e.getDroppedExp() * multiplier;
|
double newExp = e.getDroppedExp() * multiplier;
|
||||||
int newExpInt = (int) newExp;
|
int newExpInt = (int) newExp;
|
||||||
e.setDroppedExp(newExpInt);
|
e.setDroppedExp(newExpInt);
|
||||||
|
Loading…
Reference in New Issue
Block a user