Made it so that adding custom items for a spawner drop will cancel out the default ones.

This commit is contained in:
Brianna O'Keefe 2018-08-28 22:37:11 -04:00
parent 834398bfc7
commit b0cd5228d0

View File

@ -100,11 +100,12 @@ public class EntityListeners implements Listener {
EpicSpawnersPlugin instance = EpicSpawnersPlugin.getInstance();
if (event.getEntity().hasMetadata("ES")) {
SpawnerData spawnerData = instance.getSpawnerManager().getSpawnerData(event.getEntity().getMetadata("ES").get(0).asString());
for (ItemStack itemStack : spawnerData.getEntityDroppedItems()) {
Location location = event.getEntity().getLocation();
location.getWorld().dropItemNaturally(location, itemStack);
if (!spawnerData.getEntityDroppedItems().isEmpty()) {
event.getDrops().clear();
}
for (ItemStack itemStack : spawnerData.getEntityDroppedItems()) {
event.getDrops().add(itemStack);
}
}
if (event.getEntity().getKiller() == null) return;
Player player = event.getEntity().getKiller();