use of io.lumine.xikage.mythicmobs.drops.droppables.ExperienceDrop in project Parties by AlessioDP.
the class MythicMobsHandler method onMythicMobDeath.
@EventHandler
public void onMythicMobDeath(MythicMobLootDropEvent event) {
if (active && event.getKiller() instanceof Player) {
Entity killedEntity = event.getEntity();
if (event.getKiller() != null) {
PartyPlayerImpl killer = plugin.getPlayerManager().getPlayer(event.getKiller().getUniqueId());
if (killer.isInParty()) {
plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_EXP_MMHANDLING, event.getMobType().getInternalName(), killer.getName(), killer.getPlayerUUID().toString()), true);
double vanillaExp = 0;
double skillapiExp = 0;
if (BukkitConfigMain.ADDITIONAL_EXP_DROP_GET_NORMAL)
vanillaExp = event.getExp();
if (BukkitConfigMain.ADDITIONAL_EXP_DROP_GET_SKILLAPI) {
for (Drop drop : event.getDrops().getDrops()) {
if (drop instanceof SkillAPIDrop) {
skillapiExp += drop.getAmount();
}
}
}
ExpDrop drop = new ExpDrop(killer, killedEntity, vanillaExp, skillapiExp);
boolean result = ((BukkitExpManager) plugin.getExpManager()).distributeExp(drop);
if (result && BukkitConfigMain.ADDITIONAL_EXP_DROP_CONVERT_REMOVEREALEXP) {
// Remove exp from the event if hooked
if (BukkitConfigMain.ADDITIONAL_EXP_DROP_GET_NORMAL) {
// Be sure that we are removing exp from intangible drops
for (Drop d : event.getDrops().getLootTableIntangible().values()) {
if (d instanceof ExperienceDrop) {
d.setAmount(0);
}
}
// Add it to an array list that contains a list of entities
// that we need to manually remove drop experience
mobsExperienceToSuppress.add(event.getEntity().getUniqueId());
}
// Remove skillapi exp from the event if hooked
if (BukkitConfigMain.ADDITIONAL_EXP_DROP_GET_SKILLAPI) {
event.getDrops().getLootTableIntangible().remove(SkillAPIDrop.class);
}
}
}
}
}
}
Aggregations