mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-23 10:35:22 +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)
|
if (configurationSection.getInt("Mobs." + initalEntity.getType().name() + ".Max Stack Size") != -1)
|
||||||
maxEntityStackSize = configurationSection.getInt("Mobs." + initalEntity.getType().name() + ".Max Stack Size");
|
maxEntityStackSize = configurationSection.getInt("Mobs." + initalEntity.getType().name() + ".Max Stack Size");
|
||||||
|
|
||||||
List<Entity> entityList = Methods.getSimilarEntitesAroundEntity(initalEntity).stream().filter(entity ->
|
List<Entity> entityList = Methods.getSimilarEntitesAroundEntity(initalEntity);
|
||||||
!entity.hasMetadata("no-stack")
|
|
||||||
&& entity.getCustomName() == null
|
|
||||||
&& stackManager.getStack(entity) != null
|
|
||||||
&& removed.contains(entity.getUniqueId())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (Entity entity : entityList) {
|
for (Entity entity : new ArrayList<>(entityList)) {
|
||||||
|
if (removed.contains(entity.getUniqueId())) continue;
|
||||||
EntityStack stack = stackManager.getStack(entity);
|
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 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.addAmount(amtToStack);
|
||||||
stack.updateStack();
|
stack.updateStack();
|
||||||
removed.add(initalEntity.getUniqueId());
|
removed.add(initalEntity.getUniqueId());
|
||||||
@ -134,6 +135,7 @@ public class StackingTask extends BukkitRunnable {
|
|||||||
|
|
||||||
continue nextEntity;
|
continue nextEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialStack != null) continue;
|
if (initialStack != null) continue;
|
||||||
|
@ -41,7 +41,6 @@ public class Methods {
|
|||||||
UltimateStacker instance = UltimateStacker.getInstance();
|
UltimateStacker instance = UltimateStacker.getInstance();
|
||||||
EntityStackManager stackManager = instance.getEntityStackManager();
|
EntityStackManager stackManager = instance.getEntityStackManager();
|
||||||
Entity newEntity = newEntity(killed);
|
Entity newEntity = newEntity(killed);
|
||||||
killed.setMetadata("no-stack", new FixedMetadataValue(instance, true));
|
|
||||||
|
|
||||||
((LivingEntity) newEntity).getEquipment().clear();
|
((LivingEntity) newEntity).getEquipment().clear();
|
||||||
|
|
||||||
@ -71,7 +70,8 @@ public class Methods {
|
|||||||
if (!stackManager.isStacked(killed)) return;
|
if (!stackManager.isStacked(killed)) return;
|
||||||
|
|
||||||
killed.setCustomName(null);
|
killed.setCustomName(null);
|
||||||
killed.setCustomNameVisible(false);
|
killed.setCustomNameVisible(true);
|
||||||
|
killed.setCustomName(formatText("&7"));
|
||||||
|
|
||||||
EntityStack stack = stackManager.getStack(killed);
|
EntityStack stack = stackManager.getStack(killed);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user