Minor adjustments.

This commit is contained in:
Brianna 2019-06-27 23:14:40 -04:00
parent 3801d8ecbd
commit 38787e0c1e
2 changed files with 21 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -43,7 +44,22 @@ public class SpawnerListeners implements Listener {
if (!instance.spawnersEnabled() || !(event.getEntity() instanceof LivingEntity)) return;
if (instance.getStackingTask().attemptAddToStack((LivingEntity) event.getEntity(), null)) {
event.setCancelled(true);
Entity entity = event.getEntity();
if (entity.getType() == EntityType.FIREWORK) return;
if (entity.getVehicle() != null) {
entity.getVehicle().remove();
entity.remove();
}
if (instance.isServerVersionAtLeast(ServerVersion.V1_11)) {
if (entity.getPassengers().size() != 0) {
for (Entity e : entity.getPassengers()) {
e.remove();
}
entity.remove();
}
}
entity.remove();
}
}
}

View File

@ -74,11 +74,6 @@ public class StackingTask extends BukkitRunnable {
EntityStack initialStack = stackManager.getStack(initialEntity);
if (initialStack == null && initialEntity.getCustomName() != null) continue nextEntity;
ConfigurationSection configurationSection = UltimateStacker.getInstance().getMobFile().getConfig();
if (!configurationSection.getBoolean("Mobs." + initialEntity.getType().name() + ".Enabled"))
continue nextEntity;
attemptAddToStack(initialEntity, initialStack);
}
entities.clear();
@ -88,6 +83,10 @@ public class StackingTask extends BukkitRunnable {
public boolean attemptAddToStack(LivingEntity initialEntity, EntityStack initialStack) {
ConfigurationSection configurationSection = UltimateStacker.getInstance().getMobFile().getConfig();
if (!configurationSection.getBoolean("Mobs." + initialEntity.getType().name() + ".Enabled"))
return false;
int minEntityStackAmount = Setting.MIN_STACK_ENTITIES.getInt();
int amtToStack = initialStack != null ? initialStack.getAmount() : 1;