mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-28 11:27:58 +01:00
Fix
This commit is contained in:
parent
791b790247
commit
1dc3ffa34c
@ -116,17 +116,18 @@ public class StackingTask extends BukkitRunnable {
|
||||
if (configurationSection.getInt("Mobs." + initalEntity.getType().name() + ".Max Stack Size") != -1)
|
||||
maxEntityStackSize = configurationSection.getInt("Mobs." + initalEntity.getType().name() + ".Max Stack Size");
|
||||
|
||||
List<Entity> entityList = Methods.getSimilarEntitesAroundEntity(initalEntity).stream().filter(entity ->
|
||||
!entity.hasMetadata("no-stack")
|
||||
&& entity.getCustomName() == null
|
||||
&& stackManager.getStack(entity) != null
|
||||
&& removed.contains(entity.getUniqueId())).collect(Collectors.toList());
|
||||
List<Entity> entityList = Methods.getSimilarEntitesAroundEntity(initalEntity);
|
||||
|
||||
for (Entity entity : entityList) {
|
||||
for (Entity entity : new ArrayList<>(entityList)) {
|
||||
if (removed.contains(entity.getUniqueId())) continue;
|
||||
EntityStack stack = stackManager.getStack(entity);
|
||||
if (stack == null && entity.getCustomName() != null) {
|
||||
entityList.remove(entity);
|
||||
continue;
|
||||
}
|
||||
|
||||
//If a stack was found add 1 to this stack.
|
||||
if ((stack.getAmount() + amtToStack) <= maxEntityStackSize) {
|
||||
if (stack != null && (stack.getAmount() + amtToStack) <= maxEntityStackSize) {
|
||||
stack.addAmount(amtToStack);
|
||||
stack.updateStack();
|
||||
removed.add(initalEntity.getUniqueId());
|
||||
@ -134,6 +135,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
|
||||
continue nextEntity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (initialStack != null) continue;
|
||||
|
@ -41,7 +41,6 @@ public class Methods {
|
||||
UltimateStacker instance = UltimateStacker.getInstance();
|
||||
EntityStackManager stackManager = instance.getEntityStackManager();
|
||||
Entity newEntity = newEntity(killed);
|
||||
killed.setMetadata("no-stack", new FixedMetadataValue(instance, true));
|
||||
|
||||
((LivingEntity) newEntity).getEquipment().clear();
|
||||
|
||||
@ -71,7 +70,8 @@ public class Methods {
|
||||
if (!stackManager.isStacked(killed)) return;
|
||||
|
||||
killed.setCustomName(null);
|
||||
killed.setCustomNameVisible(false);
|
||||
killed.setCustomNameVisible(true);
|
||||
killed.setCustomName(formatText("&7"));
|
||||
|
||||
EntityStack stack = stackManager.getStack(killed);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user