mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-28 11:27:58 +01:00
Fix compatibility issues with 3rd party loot plugins
This commit is contained in:
parent
4576a5c53c
commit
91e31c24c3
@ -58,40 +58,42 @@ public class DeathListeners implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
boolean custom = Settings.CUSTOM_DROPS.getBoolean();
|
||||
|
||||
if (!custom) return; //Compatibility with other plugins
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||
&& !entity.getWorld().getGameRuleValue(GameRule.DO_MOB_LOOT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntityType() == EntityType.PLAYER
|
||||
|| event.getEntityType() == EntityType.ARMOR_STAND) return;
|
||||
|
||||
//Respect MythicMobs
|
||||
if (plugin.getCustomEntityManager().isCustomEntity(entity)) return;
|
||||
|
||||
boolean custom = Settings.CUSTOM_DROPS.getBoolean();
|
||||
List<Drop> drops = custom ? plugin.getLootablesManager().getDrops(event.getEntity())
|
||||
: event.getDrops().stream().map(Drop::new).collect(Collectors.toList());
|
||||
|
||||
if (custom) {
|
||||
for (ItemStack item : new ArrayList<>(event.getDrops())) {
|
||||
if (shouldDrop(event.getEntity(), item.getType()))
|
||||
drops.add(new Drop(item));
|
||||
}
|
||||
List<Drop> drops = plugin.getLootablesManager().getDrops(event.getEntity());
|
||||
|
||||
for (ItemStack item : new ArrayList<>(event.getDrops())) {
|
||||
if (shouldDrop(event.getEntity(), item.getType()))
|
||||
drops.add(new Drop(item));
|
||||
}
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||
&& !entity.getWorld().getGameRuleValue(GameRule.DO_MOB_LOOT))
|
||||
drops.clear();
|
||||
|
||||
if (plugin.getCustomEntityManager().getCustomEntity(entity) == null) {
|
||||
//replace %player% in drop commands with the last player to damage the entity
|
||||
//Run commands here, or it will be buggy
|
||||
runCommands(entity, drops);
|
||||
|
||||
if (plugin.getEntityStackManager().isStackedEntity(event.getEntity())) {
|
||||
plugin.getEntityStackManager().getStack(event.getEntity()).onDeath(entity, drops, custom, event.getDroppedExp(), event);
|
||||
plugin.getEntityStackManager().getStack(event.getEntity()).onDeath(entity, drops, true, event.getDroppedExp(), event);
|
||||
} else {
|
||||
DropUtils.processStackedDrop(event.getEntity(), drops, event);
|
||||
}
|
||||
}
|
||||
|
||||
finalItems.remove(entity.getUniqueId());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user