mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-08 03:21:32 +01:00
Clean up.
This commit is contained in:
parent
442334d898
commit
00423da2ef
@ -2,7 +2,9 @@ package com.songoda.ultimatestacker.listeners;
|
||||
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.utils.settings.Setting;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -10,6 +12,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DeathListeners implements Listener {
|
||||
@ -23,21 +26,18 @@ public class DeathListeners implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
List<ItemStack> items = Setting.CUSTOM_DROPS.getBoolean()
|
||||
? instance.getLootManager().getDrops(event.getEntity()) : event.getDrops();
|
||||
? instance.getLootManager().getDrops(event.getEntity()) : new ArrayList<>();
|
||||
|
||||
if (items.size() != 0) {
|
||||
if (event.getEntity() instanceof Pig && ((Pig) event.getEntity()).hasSaddle())
|
||||
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(),
|
||||
new ItemStack(Material.SADDLE));
|
||||
|
||||
event.getDrops().clear();
|
||||
|
||||
for (ItemStack item : items) {
|
||||
if (item == null) continue;
|
||||
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), item);
|
||||
}
|
||||
} else
|
||||
items = event.getDrops();
|
||||
|
||||
for (ItemStack item : items) {
|
||||
if (item == null) continue;
|
||||
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), item);
|
||||
}
|
||||
|
||||
if (instance.getEntityStackManager().isStacked(event.getEntity()))
|
||||
instance.getEntityStackManager().getStack(event.getEntity())
|
||||
|
@ -312,6 +312,13 @@ public class LootManager {
|
||||
.setAllowLootingEnchant(false).build())
|
||||
.build()));
|
||||
|
||||
// Add Llama.
|
||||
addLootable(new Lootable(EntityType.LLAMA,
|
||||
new LootBuilder()
|
||||
.setMaterial(Material.LEATHER)
|
||||
.setMin(0)
|
||||
.setMax(2).build()));
|
||||
|
||||
// Add Zombie Horse.
|
||||
addLootable(new Lootable(EntityType.ZOMBIE_HORSE,
|
||||
new LootBuilder()
|
||||
|
Loading…
Reference in New Issue
Block a user