!minor refactor

moved the exp event below holograms since the event doesn't have
anything to do with the holograms
This commit is contained in:
ASangarin 2020-06-14 16:46:15 +02:00
parent 6b400f4420
commit 668856801d

View File

@ -126,19 +126,18 @@ public class PlayerProfessions {
value = MMOCore.plugin.boosterManager.calculateExp(profession, value); value = MMOCore.plugin.boosterManager.calculateExp(profession, value);
PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(playerData, profession, value, source);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
return;
exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value);
// display hologram // display hologram
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms")) if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms"))
if (loc != null && MMOCore.plugin.hologramSupport != null) if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(playerData, profession, value, source);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
return;
exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value);
int needed, exp, level, oldLevel = getLevel(profession); int needed, exp, level, oldLevel = getLevel(profession);
/* /*