mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-03 22:37:41 +01:00
Added a check for equipment.
This commit is contained in:
parent
47e4e310de
commit
f7848a5249
@ -13,6 +13,7 @@ public enum Check {
|
|||||||
ANIMAL_OWNER(true),
|
ANIMAL_OWNER(true),
|
||||||
SKELETON_TYPE(true),
|
SKELETON_TYPE(true),
|
||||||
ZOMBIE_BABY(true),
|
ZOMBIE_BABY(true),
|
||||||
|
HAS_EQUIPMENT(true),
|
||||||
SLIME_SIZE(true),
|
SLIME_SIZE(true),
|
||||||
PIG_SADDLE(true),
|
PIG_SADDLE(true),
|
||||||
SHEEP_SHEARED(true),
|
SHEEP_SHEARED(true),
|
||||||
|
@ -133,7 +133,7 @@ public class Settings {
|
|||||||
"This list is ignored if Only Stack From Spawners = true.",
|
"This list is ignored if Only Stack From Spawners = true.",
|
||||||
"The following reasons can be added to the list:",
|
"The following reasons can be added to the list:",
|
||||||
"\"NATURAL\", \"JOCKEY\", \"CHUNK_GEN\", \"SPAWNER\",",
|
"\"NATURAL\", \"JOCKEY\", \"CHUNK_GEN\", \"SPAWNER\",",
|
||||||
"\"EGG\", \"SPAWNER_EGG\", \"LIGHTNING\", \"BUILD_SNOWMAN\",",
|
"\"EGG\", \"SPAWNER_EGG\", \"LIGHTNING\", \"BUILD_SNOWMAN\", \"HAS_EQUIPMENT\",",
|
||||||
"\"BUILD_IRONGOLEM\", \"BUILD_WITHER\", \"VILLAGE_DEFENSE\", \"VILLAGE_INVASION\",",
|
"\"BUILD_IRONGOLEM\", \"BUILD_WITHER\", \"VILLAGE_DEFENSE\", \"VILLAGE_INVASION\",",
|
||||||
"\"BREEDING\", \"SLIME_SPLIT\", \"REINFORCEMENTS\", \"NETHER_PORTAL\",",
|
"\"BREEDING\", \"SLIME_SPLIT\", \"REINFORCEMENTS\", \"NETHER_PORTAL\",",
|
||||||
"\"DISPENSE_EGG\", \"INFECTION\", \"CURED\", \"OCELOT_BABY\",",
|
"\"DISPENSE_EGG\", \"INFECTION\", \"CURED\", \"OCELOT_BABY\",",
|
||||||
|
@ -5,9 +5,7 @@ import com.songoda.ultimatestacker.UltimateStacker;
|
|||||||
import com.songoda.ultimatestacker.entity.Check;
|
import com.songoda.ultimatestacker.entity.Check;
|
||||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||||
import com.songoda.ultimatestacker.settings.Settings;
|
import com.songoda.ultimatestacker.settings.Settings;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -241,27 +239,27 @@ public class EntityUtils {
|
|||||||
return newEntity;
|
return newEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LivingEntity> getSimilarEntitiesAroundEntity(LivingEntity initalEntity, Location location) {
|
public List<LivingEntity> getSimilarEntitiesAroundEntity(LivingEntity initialEntity, Location location) {
|
||||||
// Create a list of all entities around the initial entity of the same type.
|
// Create a list of all entities around the initial entity of the same type.
|
||||||
List<LivingEntity> entityList = getNearbyEntities(location, searchRadius, stackWholeChunk)
|
List<LivingEntity> entityList = getNearbyEntities(location, searchRadius, stackWholeChunk)
|
||||||
.stream().filter(entity -> entity.getType() == initalEntity.getType() && entity != initalEntity)
|
.stream().filter(entity -> entity.getType() == initialEntity.getType() && entity != initialEntity)
|
||||||
.collect(Collectors.toCollection(LinkedList::new));
|
.collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
|
||||||
if (stackFlyingDown && Methods.canFly(initalEntity))
|
if (stackFlyingDown && Methods.canFly(initialEntity))
|
||||||
entityList.removeIf(entity -> entity.getLocation().getY() > initalEntity.getLocation().getY());
|
entityList.removeIf(entity -> entity.getLocation().getY() > initialEntity.getLocation().getY());
|
||||||
|
|
||||||
for (String checkStr : checks) {
|
for (String checkStr : checks) {
|
||||||
Check check = Check.getCheck(checkStr);
|
Check check = Check.getCheck(checkStr);
|
||||||
if (check == null) continue;
|
if (check == null) continue;
|
||||||
switch (check) {
|
switch (check) {
|
||||||
case SPAWN_REASON: {
|
case SPAWN_REASON: {
|
||||||
if (initalEntity.hasMetadata("US_REASON"))
|
if (initialEntity.hasMetadata("US_REASON"))
|
||||||
entityList.removeIf(entity -> entity.hasMetadata("US_REASON") && !entity.getMetadata("US_REASON").get(0).asString().equals("US_REASON"));
|
entityList.removeIf(entity -> entity.hasMetadata("US_REASON") && !entity.getMetadata("US_REASON").get(0).asString().equals("US_REASON"));
|
||||||
}
|
}
|
||||||
case AGE: {
|
case AGE: {
|
||||||
if (!(initalEntity instanceof Ageable)) break;
|
if (!(initialEntity instanceof Ageable)) break;
|
||||||
|
|
||||||
if (((Ageable) initalEntity).isAdult()) {
|
if (((Ageable) initialEntity).isAdult()) {
|
||||||
entityList.removeIf(entity -> !((Ageable) entity).isAdult());
|
entityList.removeIf(entity -> !((Ageable) entity).isAdult());
|
||||||
} else {
|
} else {
|
||||||
entityList.removeIf(entity -> ((Ageable) entity).isAdult());
|
entityList.removeIf(entity -> ((Ageable) entity).isAdult());
|
||||||
@ -270,45 +268,45 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
case NERFED: {
|
case NERFED: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) break;
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) break;
|
||||||
entityList.removeIf(entity -> entity.hasAI() != initalEntity.hasAI());
|
entityList.removeIf(entity -> entity.hasAI() != initialEntity.hasAI());
|
||||||
}
|
}
|
||||||
case IS_TAMED: {
|
case IS_TAMED: {
|
||||||
if (!(initalEntity instanceof Tameable)) break;
|
if (!(initialEntity instanceof Tameable)) break;
|
||||||
if (((Tameable) initalEntity).isTamed()) {
|
if (((Tameable) initialEntity).isTamed()) {
|
||||||
entityList.removeIf(entity -> !((Tameable) entity).isTamed());
|
entityList.removeIf(entity -> !((Tameable) entity).isTamed());
|
||||||
} else {
|
} else {
|
||||||
entityList.removeIf(entity -> ((Tameable) entity).isTamed());
|
entityList.removeIf(entity -> ((Tameable) entity).isTamed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ANIMAL_OWNER: {
|
case ANIMAL_OWNER: {
|
||||||
if (!(initalEntity instanceof Tameable)) break;
|
if (!(initialEntity instanceof Tameable)) break;
|
||||||
|
|
||||||
Tameable tameable = ((Tameable) initalEntity);
|
Tameable tameable = ((Tameable) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Tameable) entity).getOwner() != tameable.getOwner());
|
entityList.removeIf(entity -> ((Tameable) entity).getOwner() != tameable.getOwner());
|
||||||
}
|
}
|
||||||
case PIG_SADDLE: {
|
case PIG_SADDLE: {
|
||||||
if (!(initalEntity instanceof Pig)) break;
|
if (!(initialEntity instanceof Pig)) break;
|
||||||
entityList.removeIf(entity -> ((Pig) entity).hasSaddle());
|
entityList.removeIf(entity -> ((Pig) entity).hasSaddle());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SKELETON_TYPE: {
|
case SKELETON_TYPE: {
|
||||||
if (!(initalEntity instanceof Skeleton)) break;
|
if (!(initialEntity instanceof Skeleton)) break;
|
||||||
|
|
||||||
Skeleton skeleton = (Skeleton) initalEntity;
|
Skeleton skeleton = (Skeleton) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Skeleton) entity).getSkeletonType() != skeleton.getSkeletonType());
|
entityList.removeIf(entity -> ((Skeleton) entity).getSkeletonType() != skeleton.getSkeletonType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SHEEP_COLOR: {
|
case SHEEP_COLOR: {
|
||||||
if (!(initalEntity instanceof Sheep)) break;
|
if (!(initialEntity instanceof Sheep)) break;
|
||||||
|
|
||||||
Sheep sheep = ((Sheep) initalEntity);
|
Sheep sheep = ((Sheep) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Sheep) entity).getColor() != sheep.getColor());
|
entityList.removeIf(entity -> ((Sheep) entity).getColor() != sheep.getColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SHEEP_SHEARED: {
|
case SHEEP_SHEARED: {
|
||||||
if (!(initalEntity instanceof Sheep)) break;
|
if (!(initialEntity instanceof Sheep)) break;
|
||||||
|
|
||||||
Sheep sheep = ((Sheep) initalEntity);
|
Sheep sheep = ((Sheep) initialEntity);
|
||||||
if (sheep.isSheared()) {
|
if (sheep.isSheared()) {
|
||||||
entityList.removeIf(entity -> !((Sheep) entity).isSheared());
|
entityList.removeIf(entity -> !((Sheep) entity).isSheared());
|
||||||
} else {
|
} else {
|
||||||
@ -318,9 +316,9 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
case SNOWMAN_DERPED: {
|
case SNOWMAN_DERPED: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)
|
||||||
|| !(initalEntity instanceof Snowman)) break;
|
|| !(initialEntity instanceof Snowman)) break;
|
||||||
|
|
||||||
Snowman snowman = ((Snowman) initalEntity);
|
Snowman snowman = ((Snowman) initialEntity);
|
||||||
if (snowman.isDerp()) {
|
if (snowman.isDerp()) {
|
||||||
entityList.removeIf(entity -> !((Snowman) entity).isDerp());
|
entityList.removeIf(entity -> !((Snowman) entity).isDerp());
|
||||||
} else {
|
} else {
|
||||||
@ -330,162 +328,184 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
case LLAMA_COLOR: {
|
case LLAMA_COLOR: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)
|
||||||
|| !(initalEntity instanceof Llama)) break;
|
|| !(initialEntity instanceof Llama)) break;
|
||||||
Llama llama = ((Llama) initalEntity);
|
Llama llama = ((Llama) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Llama) entity).getColor() != llama.getColor());
|
entityList.removeIf(entity -> ((Llama) entity).getColor() != llama.getColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LLAMA_STRENGTH: {
|
case LLAMA_STRENGTH: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)
|
||||||
|| !(initalEntity instanceof Llama)) break;
|
|| !(initialEntity instanceof Llama)) break;
|
||||||
Llama llama = ((Llama) initalEntity);
|
Llama llama = ((Llama) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Llama) entity).getStrength() != llama.getStrength());
|
entityList.removeIf(entity -> ((Llama) entity).getStrength() != llama.getStrength());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VILLAGER_PROFESSION: {
|
case VILLAGER_PROFESSION: {
|
||||||
if (!(initalEntity instanceof Villager)) break;
|
if (!(initialEntity instanceof Villager)) break;
|
||||||
Villager villager = ((Villager) initalEntity);
|
Villager villager = ((Villager) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Villager) entity).getProfession() != villager.getProfession());
|
entityList.removeIf(entity -> ((Villager) entity).getProfession() != villager.getProfession());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SLIME_SIZE: {
|
case SLIME_SIZE: {
|
||||||
if (!(initalEntity instanceof Slime)) break;
|
if (!(initialEntity instanceof Slime)) break;
|
||||||
Slime slime = ((Slime) initalEntity);
|
Slime slime = ((Slime) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Slime) entity).getSize() != slime.getSize());
|
entityList.removeIf(entity -> ((Slime) entity).getSize() != slime.getSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_CARRYING_CHEST: {
|
case HORSE_CARRYING_CHEST: {
|
||||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
|
||||||
if (!(initalEntity instanceof ChestedHorse)) break;
|
if (!(initialEntity instanceof ChestedHorse)) break;
|
||||||
entityList.removeIf(entity -> ((ChestedHorse) entity).isCarryingChest());
|
entityList.removeIf(entity -> ((ChestedHorse) entity).isCarryingChest());
|
||||||
} else {
|
} else {
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
entityList.removeIf(entity -> ((Horse) entity).isCarryingChest());
|
entityList.removeIf(entity -> ((Horse) entity).isCarryingChest());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_HAS_ARMOR: {
|
case HORSE_HAS_ARMOR: {
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
entityList.removeIf(entity -> ((Horse) entity).getInventory().getArmor() != null);
|
entityList.removeIf(entity -> ((Horse) entity).getInventory().getArmor() != null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_HAS_SADDLE: {
|
case HORSE_HAS_SADDLE: {
|
||||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
&& initalEntity instanceof AbstractHorse) {
|
&& initialEntity instanceof AbstractHorse) {
|
||||||
entityList.removeIf(entity -> ((AbstractHorse) entity).getInventory().getSaddle() != null);
|
entityList.removeIf(entity -> ((AbstractHorse) entity).getInventory().getSaddle() != null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
entityList.removeIf(entity -> ((Horse) entity).getInventory().getSaddle() != null);
|
entityList.removeIf(entity -> ((Horse) entity).getInventory().getSaddle() != null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_JUMP: {
|
case HORSE_JUMP: {
|
||||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
|
||||||
if (!(initalEntity instanceof AbstractHorse)) break;
|
if (!(initialEntity instanceof AbstractHorse)) break;
|
||||||
AbstractHorse horse = ((AbstractHorse) initalEntity);
|
AbstractHorse horse = ((AbstractHorse) initialEntity);
|
||||||
entityList.removeIf(entity -> ((AbstractHorse) entity).getJumpStrength() != horse.getJumpStrength());
|
entityList.removeIf(entity -> ((AbstractHorse) entity).getJumpStrength() != horse.getJumpStrength());
|
||||||
} else {
|
} else {
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
Horse horse = ((Horse) initalEntity);
|
Horse horse = ((Horse) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Horse) entity).getJumpStrength() != horse.getJumpStrength());
|
entityList.removeIf(entity -> ((Horse) entity).getJumpStrength() != horse.getJumpStrength());
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_COLOR: {
|
case HORSE_COLOR: {
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
Horse horse = ((Horse) initalEntity);
|
Horse horse = ((Horse) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Horse) entity).getColor() != horse.getColor());
|
entityList.removeIf(entity -> ((Horse) entity).getColor() != horse.getColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HORSE_STYLE: {
|
case HORSE_STYLE: {
|
||||||
if (!(initalEntity instanceof Horse)) break;
|
if (!(initialEntity instanceof Horse)) break;
|
||||||
Horse horse = ((Horse) initalEntity);
|
Horse horse = ((Horse) initialEntity);
|
||||||
entityList.removeIf(entity -> ((Horse) entity).getStyle() != horse.getStyle());
|
entityList.removeIf(entity -> ((Horse) entity).getStyle() != horse.getStyle());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ZOMBIE_BABY: {
|
case ZOMBIE_BABY: {
|
||||||
if (!(initalEntity instanceof Zombie)) break;
|
if (!(initialEntity instanceof Zombie)) break;
|
||||||
Zombie zombie = (Zombie) initalEntity;
|
Zombie zombie = (Zombie) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Zombie) entity).isBaby() != zombie.isBaby());
|
entityList.removeIf(entity -> ((Zombie) entity).isBaby() != zombie.isBaby());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WOLF_COLLAR_COLOR: {
|
case WOLF_COLLAR_COLOR: {
|
||||||
if (!(initalEntity instanceof Wolf)) break;
|
if (!(initialEntity instanceof Wolf)) break;
|
||||||
Wolf wolf = (Wolf) initalEntity;
|
Wolf wolf = (Wolf) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Wolf) entity).getCollarColor() != wolf.getCollarColor());
|
entityList.removeIf(entity -> ((Wolf) entity).getCollarColor() != wolf.getCollarColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OCELOT_TYPE: {
|
case OCELOT_TYPE: {
|
||||||
if (!(initalEntity instanceof Ocelot)) break;
|
if (!(initialEntity instanceof Ocelot)) break;
|
||||||
Ocelot ocelot = (Ocelot) initalEntity;
|
Ocelot ocelot = (Ocelot) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Ocelot) entity).getCatType() != ocelot.getCatType());
|
entityList.removeIf(entity -> ((Ocelot) entity).getCatType() != ocelot.getCatType());
|
||||||
}
|
}
|
||||||
case CAT_TYPE: {
|
case CAT_TYPE: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)
|
||||||
|| !(initalEntity instanceof Cat)) break;
|
|| !(initialEntity instanceof Cat)) break;
|
||||||
Cat cat = (Cat) initalEntity;
|
Cat cat = (Cat) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Cat) entity).getCatType() != cat.getCatType());
|
entityList.removeIf(entity -> ((Cat) entity).getCatType() != cat.getCatType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case HAS_EQUIPMENT: {
|
||||||
|
if (initialEntity.getEquipment() == null) break;
|
||||||
|
boolean imEquipped = isEquipped(initialEntity);
|
||||||
|
if (imEquipped)
|
||||||
|
entityList = new ArrayList<>();
|
||||||
|
else
|
||||||
|
entityList.removeIf(this::isEquipped);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case RABBIT_TYPE: {
|
case RABBIT_TYPE: {
|
||||||
if (!(initalEntity instanceof Rabbit)) break;
|
if (!(initialEntity instanceof Rabbit)) break;
|
||||||
Rabbit rabbit = (Rabbit) initalEntity;
|
Rabbit rabbit = (Rabbit) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Rabbit) entity).getRabbitType() != rabbit.getRabbitType());
|
entityList.removeIf(entity -> ((Rabbit) entity).getRabbitType() != rabbit.getRabbitType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PARROT_TYPE: {
|
case PARROT_TYPE: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)
|
||||||
|| !(initalEntity instanceof Parrot)) break;
|
|| !(initialEntity instanceof Parrot)) break;
|
||||||
Parrot parrot = (Parrot) initalEntity;
|
Parrot parrot = (Parrot) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Parrot) entity).getVariant() != parrot.getVariant());
|
entityList.removeIf(entity -> ((Parrot) entity).getVariant() != parrot.getVariant());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PUFFERFISH_STATE: {
|
case PUFFERFISH_STATE: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
|| !(initalEntity instanceof PufferFish)) break;
|
|| !(initialEntity instanceof PufferFish)) break;
|
||||||
PufferFish pufferFish = (PufferFish) initalEntity;
|
PufferFish pufferFish = (PufferFish) initialEntity;
|
||||||
entityList.removeIf(entity -> ((PufferFish) entity).getPuffState() != pufferFish.getPuffState());
|
entityList.removeIf(entity -> ((PufferFish) entity).getPuffState() != pufferFish.getPuffState());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TROPICALFISH_PATTERN: {
|
case TROPICALFISH_PATTERN: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
|| !(initalEntity instanceof TropicalFish)) break;
|
|| !(initialEntity instanceof TropicalFish)) break;
|
||||||
TropicalFish tropicalFish = (TropicalFish) initalEntity;
|
TropicalFish tropicalFish = (TropicalFish) initialEntity;
|
||||||
entityList.removeIf(entity -> ((TropicalFish) entity).getPattern() != tropicalFish.getPattern());
|
entityList.removeIf(entity -> ((TropicalFish) entity).getPattern() != tropicalFish.getPattern());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TROPICALFISH_PATTERN_COLOR: {
|
case TROPICALFISH_PATTERN_COLOR: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
|| !(initalEntity instanceof TropicalFish)) break;
|
|| !(initialEntity instanceof TropicalFish)) break;
|
||||||
TropicalFish tropicalFish = (TropicalFish) initalEntity;
|
TropicalFish tropicalFish = (TropicalFish) initialEntity;
|
||||||
entityList.removeIf(entity -> ((TropicalFish) entity).getPatternColor() != tropicalFish.getPatternColor());
|
entityList.removeIf(entity -> ((TropicalFish) entity).getPatternColor() != tropicalFish.getPatternColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TROPICALFISH_BODY_COLOR: {
|
case TROPICALFISH_BODY_COLOR: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
|| !(initalEntity instanceof TropicalFish)) break;
|
|| !(initialEntity instanceof TropicalFish)) break;
|
||||||
TropicalFish tropicalFish = (TropicalFish) initalEntity;
|
TropicalFish tropicalFish = (TropicalFish) initialEntity;
|
||||||
entityList.removeIf(entity -> ((TropicalFish) entity).getBodyColor() != tropicalFish.getBodyColor());
|
entityList.removeIf(entity -> ((TropicalFish) entity).getBodyColor() != tropicalFish.getBodyColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PHANTOM_SIZE: {
|
case PHANTOM_SIZE: {
|
||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||||
|| !(initalEntity instanceof Phantom)) break;
|
|| !(initialEntity instanceof Phantom)) break;
|
||||||
Phantom phantom = (Phantom) initalEntity;
|
Phantom phantom = (Phantom) initialEntity;
|
||||||
entityList.removeIf(entity -> ((Phantom) entity).getSize() != phantom.getSize());
|
entityList.removeIf(entity -> ((Phantom) entity).getSize() != phantom.getSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initalEntity.hasMetadata("breedCooldown")) {
|
if (initialEntity.hasMetadata("breedCooldown")) {
|
||||||
entityList.removeIf(entity -> !entity.hasMetadata("breedCooldown"));
|
entityList.removeIf(entity -> !entity.hasMetadata("breedCooldown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return entityList;
|
return entityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEquipped(LivingEntity initialEntity) {
|
||||||
|
return initialEntity.getEquipment() != null
|
||||||
|
&& (initialEntity.getEquipment().getItemInHand().getType() != Material.AIR
|
||||||
|
|| (initialEntity.getEquipment().getHelmet() != null
|
||||||
|
&& initialEntity.getEquipment().getHelmet().getType() != Material.AIR)
|
||||||
|
|| (initialEntity.getEquipment().getChestplate() != null
|
||||||
|
&& initialEntity.getEquipment().getChestplate().getType() != Material.AIR)
|
||||||
|
|| (initialEntity.getEquipment().getLeggings() != null
|
||||||
|
&& initialEntity.getEquipment().getLeggings().getType() != Material.AIR)
|
||||||
|
|| (initialEntity.getEquipment().getBoots() != null
|
||||||
|
&& initialEntity.getEquipment().getBoots().getType() != Material.AIR));
|
||||||
|
}
|
||||||
|
|
||||||
public void splitFromStack(LivingEntity entity) {
|
public void splitFromStack(LivingEntity entity) {
|
||||||
UltimateStacker instance = plugin;
|
UltimateStacker instance = plugin;
|
||||||
EntityStack stack = instance.getEntityStackManager().getStack(entity);
|
EntityStack stack = instance.getEntityStackManager().getStack(entity);
|
||||||
|
Loading…
Reference in New Issue
Block a user