diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 681c46d..d6d5384 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "UltimateStacker" path: "/builds/$CI_PROJECT_PATH" - version: "1.9.1" + version: "1.9.2" build: stage: build diff --git a/src/main/java/com/songoda/ultimatestacker/listeners/TameListeners.java b/src/main/java/com/songoda/ultimatestacker/listeners/TameListeners.java index fdab297..856bf2f 100644 --- a/src/main/java/com/songoda/ultimatestacker/listeners/TameListeners.java +++ b/src/main/java/com/songoda/ultimatestacker/listeners/TameListeners.java @@ -37,8 +37,9 @@ public class TameListeners implements Listener { LivingEntity newEntity = plugin.getEntityUtils().newEntity((LivingEntity) tameable); - plugin.getEntityStackManager().addStack(new EntityStack(newEntity, stack.getAmount() - 1)); + EntityStack second = plugin.getEntityStackManager().addStack(new EntityStack(newEntity, stack.getAmount() - 1)); stack.setAmount(1); + second.setAmount(stack.getAmount() - 1); plugin.getEntityStackManager().removeStack(entity); entity.setVelocity(getRandomVector()); } diff --git a/src/main/java/com/songoda/ultimatestacker/utils/EntityUtils.java b/src/main/java/com/songoda/ultimatestacker/utils/EntityUtils.java index 3960d46..9b3a0c9 100644 --- a/src/main/java/com/songoda/ultimatestacker/utils/EntityUtils.java +++ b/src/main/java/com/songoda/ultimatestacker/utils/EntityUtils.java @@ -266,7 +266,11 @@ public class EntityUtils { } case IS_TAMED: { if (!(initalEntity instanceof Tameable)) break; - entityList.removeIf(entity -> ((Tameable) entity).isTamed()); + if (((Tameable) initalEntity).isTamed()) { + entityList.removeIf(entity -> !((Tameable) entity).isTamed()); + } else { + entityList.removeIf(entity -> ((Tameable) entity).isTamed()); + } } case ANIMAL_OWNER: { if (!(initalEntity instanceof Tameable)) break;