mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-08 03:21:32 +01:00
No longer stacking named entities.
This commit is contained in:
parent
b606d33c44
commit
40c95c6936
@ -212,14 +212,19 @@ public class StackingTask extends BukkitRunnable {
|
||||
|| minEntityStackSize > maxEntityStackSize) return;
|
||||
|
||||
// If a stack was never found create a new one.
|
||||
EntityStack newStack = stackManager.addStack(new EntityStack(livingEntity, (stackableFriends.size() + 1) >
|
||||
maxEntityStackSize ? maxEntityStackSize : stackableFriends.size() + 1));
|
||||
EntityStack newStack = stackManager.addStack(new EntityStack(livingEntity,
|
||||
Math.min((stackableFriends.size() + 1), maxEntityStackSize)));
|
||||
|
||||
// Loop through the unstacked and unprocessed stackable friends while not creating
|
||||
// a stack larger than the maximum.
|
||||
stackableFriends.stream().filter(entity -> !stackManager.isStacked(entity)
|
||||
&& !this.processed.contains(entity.getUniqueId())).limit(maxEntityStackSize).forEach(entity -> {
|
||||
|
||||
// Make sure we're not naming some poor kids pet.
|
||||
if (entity.getCustomName() != null) {
|
||||
processed.add(livingEntity.getUniqueId());
|
||||
return;
|
||||
}
|
||||
// Fix the entities health.
|
||||
fixHealth(livingEntity, entity);
|
||||
newStack.addHealth(entity.getHealth());
|
||||
@ -262,7 +267,6 @@ public class StackingTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void fixHealth(LivingEntity entity, LivingEntity initialEntity) {
|
||||
if (!Setting.STACK_ENTITY_HEALTH.getBoolean() && Setting.CARRY_OVER_LOWEST_HEALTH.getBoolean() && initialEntity.getHealth() < entity.getHealth())
|
||||
entity.setHealth(initialEntity.getHealth());
|
||||
|
Loading…
Reference in New Issue
Block a user