mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-03 22:37:41 +01:00
Merge branch 'development'
This commit is contained in:
commit
2ef1436618
@ -1,21 +0,0 @@
|
|||||||
stages:
|
|
||||||
- build
|
|
||||||
|
|
||||||
variables:
|
|
||||||
name: "UltimateStacker"
|
|
||||||
path: "/builds/$CI_PROJECT_PATH"
|
|
||||||
version: "1.10.22"
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
image: maven:3.5.3-jdk-8
|
|
||||||
script:
|
|
||||||
- find $path/ -type f -name "*.xml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
|
|
||||||
- find $path/ -type f -name "*.yml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
|
|
||||||
- mvn clean package
|
|
||||||
- find $path/ -depth -path '*original*' -delete
|
|
||||||
- mv -v $path/target/*.jar $path
|
|
||||||
artifacts:
|
|
||||||
name: $name-$version
|
|
||||||
paths:
|
|
||||||
- "$path/*.jar"
|
|
27
pom.xml
27
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateStacker</artifactId>
|
<artifactId>UltimateStacker</artifactId>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<version>maven-version-number</version>
|
<version>1.10.23</version>
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<finalName>UltimateStacker-${project.version}</finalName>
|
<finalName>UltimateStacker-${project.version}</finalName>
|
||||||
@ -16,6 +16,28 @@
|
|||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||||
|
<artifactId>replacer</artifactId>
|
||||||
|
<version>1.5.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>prepare-package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>replace</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<file>${project.build.directory}/classes/plugin.yml</file>
|
||||||
|
<replacements>
|
||||||
|
<replacement>
|
||||||
|
<token>maven-version-number</token>
|
||||||
|
<value>${project.version}</value>
|
||||||
|
</replacement>
|
||||||
|
</replacements>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
@ -35,6 +57,9 @@
|
|||||||
<includes>
|
<includes>
|
||||||
<include>com.songoda:SongodaCore</include>
|
<include>com.songoda:SongodaCore</include>
|
||||||
<include>com.songoda:Lootables</include>
|
<include>com.songoda:Lootables</include>
|
||||||
|
<include>com.zaxxer:HikariCP</include>
|
||||||
|
<include>org.slf4j:slf4j-api</include>
|
||||||
|
<include>org.slf4j:slf4j-nop</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<filters>
|
<filters>
|
||||||
|
@ -342,8 +342,6 @@ public class UltimateStacker extends SongodaPlugin {
|
|||||||
public void updateHologram(SpawnerStack stack) {
|
public void updateHologram(SpawnerStack stack) {
|
||||||
// are holograms enabled?
|
// are holograms enabled?
|
||||||
if(!Settings.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
if(!Settings.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
||||||
// verify that this is a spawner stack
|
|
||||||
if (stack.getLocation().getBlock().getType() != CompatibleMaterial.SPAWNER.getMaterial()) return;
|
|
||||||
// grab the spawner block
|
// grab the spawner block
|
||||||
CreatureSpawner creatureSpawner = (CreatureSpawner) stack.getLocation().getBlock().getState();
|
CreatureSpawner creatureSpawner = (CreatureSpawner) stack.getLocation().getBlock().getState();
|
||||||
String name = Methods.compileSpawnerName(creatureSpawner.getSpawnedType(), stack.getAmount());
|
String name = Methods.compileSpawnerName(creatureSpawner.getSpawnedType(), stack.getAmount());
|
||||||
|
@ -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),
|
||||||
|
@ -146,6 +146,9 @@ public class EntityStack {
|
|||||||
newEntity.getEquipment().setItemInHand(CompatibleMaterial.GOLDEN_SWORD.getItem());
|
newEntity.getEquipment().setItemInHand(CompatibleMaterial.GOLDEN_SWORD.getItem());
|
||||||
|
|
||||||
if (Settings.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
|
if (Settings.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
|
||||||
|
if (killed.hasMetadata("US_REASON"))
|
||||||
|
newEntity.setMetadata("US_REASON", killed.getMetadata("US_REASON").get(0));
|
||||||
|
|
||||||
if (killed.hasMetadata("ES"))
|
if (killed.hasMetadata("ES"))
|
||||||
newEntity.setMetadata("ES", killed.getMetadata("ES").get(0));
|
newEntity.setMetadata("ES", killed.getMetadata("ES").get(0));
|
||||||
|
|
||||||
@ -197,7 +200,9 @@ public class EntityStack {
|
|||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
synchronized (healthLock) {
|
synchronized (healthLock) {
|
||||||
entity.setHealth(Settings.STACK_ENTITY_HEALTH.getBoolean()
|
entity.setHealth(Settings.STACK_ENTITY_HEALTH.getBoolean()
|
||||||
&& !this.health.isEmpty() ? this.health.removeFirst() : entity.getMaxHealth());
|
&& !health.isEmpty()
|
||||||
|
? (health.getFirst() > entity.getMaxHealth() ? entity.getMaxHealth() : health.removeFirst())
|
||||||
|
: entity.getMaxHealth());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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