mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-15 22:55:24 +01:00
Merge branch 'development'
This commit is contained in:
commit
024ee54540
2
pom.xml
2
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>1.11.1</version>
|
<version>1.11.2</version>
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<finalName>UltimateStacker-${project.version}</finalName>
|
<finalName>UltimateStacker-${project.version}</finalName>
|
||||||
|
@ -110,6 +110,8 @@ public class EntityStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleWholeStackDeath(LivingEntity killed, List<Drop> drops, boolean custom, int droppedExp, EntityDeathEvent event) {
|
private void handleWholeStackDeath(LivingEntity killed, List<Drop> drops, boolean custom, int droppedExp, EntityDeathEvent event) {
|
||||||
|
UltimateStacker.getInstance().getEntityStackManager().removeStack(event.getEntity());
|
||||||
|
|
||||||
Location killedLocation = killed.getLocation();
|
Location killedLocation = killed.getLocation();
|
||||||
List<Drop> preStackedDrops = new ArrayList<>();
|
List<Drop> preStackedDrops = new ArrayList<>();
|
||||||
for (int i = 1; i < amount; i++) {
|
for (int i = 1; i < amount; i++) {
|
||||||
@ -172,8 +174,7 @@ public class EntityStack {
|
|||||||
|
|
||||||
public void onDeath(LivingEntity killed, List<Drop> drops, boolean custom, int droppedExp, EntityDeathEvent event) {
|
public void onDeath(LivingEntity killed, List<Drop> drops, boolean custom, int droppedExp, EntityDeathEvent event) {
|
||||||
killed.setCustomName(null);
|
killed.setCustomName(null);
|
||||||
killed.setCustomNameVisible(true);
|
killed.setCustomNameVisible(false);
|
||||||
killed.setCustomName(Methods.formatText("&7"));
|
|
||||||
|
|
||||||
boolean killWholeStack = Settings.KILL_WHOLE_STACK_ON_DEATH.getBoolean()
|
boolean killWholeStack = Settings.KILL_WHOLE_STACK_ON_DEATH.getBoolean()
|
||||||
|| plugin.getMobFile().getBoolean("Mobs." + killed.getType().name() + ".Kill Whole Stack");
|
|| plugin.getMobFile().getBoolean("Mobs." + killed.getType().name() + ".Kill Whole Stack");
|
||||||
|
@ -7,6 +7,7 @@ import com.songoda.ultimatestacker.UltimateStacker;
|
|||||||
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 com.songoda.ultimatestacker.utils.DropUtils;
|
import com.songoda.ultimatestacker.utils.DropUtils;
|
||||||
|
import org.bukkit.GameRule;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.ChestedHorse;
|
import org.bukkit.entity.ChestedHorse;
|
||||||
@ -52,6 +53,9 @@ public class DeathListeners implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!event.getEntity().getWorld().getGameRuleValue(GameRule.DO_MOB_LOOT))
|
||||||
|
drops.clear();
|
||||||
|
|
||||||
if (instance.getEntityStackManager().isStacked(event.getEntity()))
|
if (instance.getEntityStackManager().isStacked(event.getEntity()))
|
||||||
instance.getEntityStackManager().getStack(event.getEntity())
|
instance.getEntityStackManager().getStack(event.getEntity())
|
||||||
.onDeath(event.getEntity(), drops, custom, event.getDroppedExp(), event);
|
.onDeath(event.getEntity(), drops, custom, event.getDroppedExp(), event);
|
||||||
|
@ -145,6 +145,11 @@ public class Settings {
|
|||||||
"With this enabled any metadata assigned from supported plugins such",
|
"With this enabled any metadata assigned from supported plugins such",
|
||||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed.");
|
"as EpicSpawners and mcMMO will be preserved when the entity is killed.");
|
||||||
|
|
||||||
|
public static final ConfigSetting WEAPONS_ARENT_EQUIPMENT = new ConfigSetting(config, "Entities.Weapons Arent Equipment", false,
|
||||||
|
"This allows entities holding weapons to stack. Enchanted weapons are excluded.",
|
||||||
|
"If you would like to disable the stacked entity check you can do that by removing",
|
||||||
|
"\"HAS_EQUIPMENT\", from the list above.");
|
||||||
|
|
||||||
public static final ConfigSetting ONLY_STACK_ON_SURFACE = new ConfigSetting(config, "Entities.Only Stack On Surface", true,
|
public static final ConfigSetting ONLY_STACK_ON_SURFACE = new ConfigSetting(config, "Entities.Only Stack On Surface", true,
|
||||||
"Should entities only be stacked if they are touching the ground",
|
"Should entities only be stacked if they are touching the ground",
|
||||||
"or swimming? This does not effect flying entities.");
|
"or swimming? This does not effect flying entities.");
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -19,10 +20,11 @@ public class EntityUtils {
|
|||||||
UltimateStacker plugin = UltimateStacker.getInstance();
|
UltimateStacker plugin = UltimateStacker.getInstance();
|
||||||
|
|
||||||
private final List<String> checks = Settings.STACK_CHECKS.getStringList();
|
private final List<String> checks = Settings.STACK_CHECKS.getStringList();
|
||||||
private final boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean();
|
private final boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean(),
|
||||||
private final boolean keepFire = Settings.KEEP_FIRE.getBoolean();
|
keepFire = Settings.KEEP_FIRE.getBoolean(),
|
||||||
private final boolean keepPotion = Settings.KEEP_POTION.getBoolean();
|
keepPotion = Settings.KEEP_POTION.getBoolean(),
|
||||||
private final boolean stackWholeChunk = Settings.STACK_WHOLE_CHUNK.getBoolean();
|
stackWholeChunk = Settings.STACK_WHOLE_CHUNK.getBoolean(),
|
||||||
|
weaponsArentEquipment = Settings.WEAPONS_ARENT_EQUIPMENT.getBoolean();
|
||||||
private final int searchRadius = Settings.SEARCH_RADIUS.getInt();
|
private final int searchRadius = Settings.SEARCH_RADIUS.getInt();
|
||||||
|
|
||||||
private final Map<CachedChunk, Entity[]> cachedChunks = new HashMap<>();
|
private final Map<CachedChunk, Entity[]> cachedChunks = new HashMap<>();
|
||||||
@ -503,16 +505,15 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEquipped(LivingEntity initialEntity) {
|
public boolean isEquipped(LivingEntity initialEntity) {
|
||||||
return initialEntity.getEquipment() != null
|
if (initialEntity.getEquipment() == null) return false;
|
||||||
&& (initialEntity.getEquipment().getItemInHand().getType() != Material.AIR
|
EntityEquipment equipment = initialEntity.getEquipment();
|
||||||
|| (initialEntity.getEquipment().getHelmet() != null
|
|
||||||
&& initialEntity.getEquipment().getHelmet().getType() != Material.AIR)
|
return (equipment.getItemInHand().getType() != Material.AIR
|
||||||
|| (initialEntity.getEquipment().getChestplate() != null
|
&& !weaponsArentEquipment && !equipment.getItemInHand().getEnchantments().isEmpty()
|
||||||
&& initialEntity.getEquipment().getChestplate().getType() != Material.AIR)
|
|| (equipment.getHelmet() != null && equipment.getHelmet().getType() != Material.AIR)
|
||||||
|| (initialEntity.getEquipment().getLeggings() != null
|
|| (equipment.getChestplate() != null && equipment.getChestplate().getType() != Material.AIR)
|
||||||
&& initialEntity.getEquipment().getLeggings().getType() != Material.AIR)
|
|| (equipment.getLeggings() != null && equipment.getLeggings().getType() != Material.AIR)
|
||||||
|| (initialEntity.getEquipment().getBoots() != null
|
|| (equipment.getBoots() != null && equipment.getBoots().getType() != Material.AIR));
|
||||||
&& initialEntity.getEquipment().getBoots().getType() != Material.AIR));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splitFromStack(LivingEntity entity) {
|
public void splitFromStack(LivingEntity entity) {
|
||||||
|
Loading…
Reference in New Issue
Block a user