mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-02-28 17:21:02 +01:00
Merge branch 'development'
This commit is contained in:
commit
e30d294d45
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateStacker</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>1.11.12</version>
|
||||
<version>1.11.13</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateStacker-${project.version}</finalName>
|
||||
|
@ -175,10 +175,13 @@ public class EntityStack {
|
||||
}
|
||||
}
|
||||
|
||||
static final int metaCarryOverMin = Settings.META_CARRY_OVER_MIN.getInt() * 20;
|
||||
|
||||
public Map<String, MetadataValue> getMetadata(LivingEntity subject) {
|
||||
Map<String, MetadataValue> v = new HashMap<>();
|
||||
if (subject.getTicksLived() >= metaCarryOverMin) return v;
|
||||
|
||||
Map<String, Map<Plugin, MetadataValue>> metadataMap = null;
|
||||
Map<String, Map<Plugin, MetadataValue>> metadataMap = null;
|
||||
try {
|
||||
Object entityMetadata = methodGetEntityMetadata.invoke(Bukkit.getServer());
|
||||
metadataMap = (Map) fieldMetadataMap.get(entityMetadata);
|
||||
|
@ -145,6 +145,13 @@ public class Settings {
|
||||
"With this enabled any metadata assigned from supported plugins such",
|
||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed.");
|
||||
|
||||
public static final ConfigSetting META_CARRY_OVER_MIN = new ConfigSetting(config, "Entities.Meta Carry Over Min", 10,
|
||||
"The amount of time in seconds an entity needs to have lived",
|
||||
"for in order for their metadata to be carried over to their next",
|
||||
"stack on death. Setting this value to zero may improve compatibility",
|
||||
"with other plugins but this will be at the cost of performance if you",
|
||||
"have a lot of grinders on your server.");
|
||||
|
||||
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",
|
||||
|
@ -38,7 +38,7 @@ public class SpawnerStack {
|
||||
&& !plugin.getStackingTask().isWorldDisabled(location.getWorld()) ? 1 : calculateSpawnCount();
|
||||
int maxNearby = amount > 6 ? amount + 3 : 6;
|
||||
CreatureSpawner creatureSpawner = (CreatureSpawner) location.getBlock().getState();
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) {
|
||||
creatureSpawner.setMaxNearbyEntities(maxNearby);
|
||||
creatureSpawner.setSpawnCount(count);
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.songoda.ultimatestacker.tasks;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.hooks.WorldGuardHook;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
@ -15,7 +16,6 @@ import org.bukkit.entity.*;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class StackingTask extends BukkitRunnable {
|
||||
|
||||
@ -119,7 +119,10 @@ public class StackingTask extends BukkitRunnable {
|
||||
return !onlyStackOnSurface
|
||||
|| Methods.canFly(livingEntity)
|
||||
|| entity.getType().name().equals("SHULKER")
|
||||
|| (livingEntity.isOnGround() || location.getBlock().isLiquid());
|
||||
|
||||
|| (livingEntity.isOnGround()
|
||||
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
|
||||
&& livingEntity.isSwimming()));
|
||||
|
||||
}
|
||||
|
||||
@ -315,9 +318,9 @@ public class StackingTask extends BukkitRunnable {
|
||||
|
||||
private int getEntityStackSize(LivingEntity initialEntity) {
|
||||
Integer max = entityStackSizes.get(initialEntity.getType());
|
||||
if(max == null) {
|
||||
if (max == null) {
|
||||
max = configurationSection.getInt("Mobs." + initialEntity.getType().name() + ".Max Stack Size");
|
||||
if(max == -1) {
|
||||
if (max == -1) {
|
||||
max = maxEntityStackSize;
|
||||
}
|
||||
entityStackSizes.put(initialEntity.getType(), max);
|
||||
|
Loading…
Reference in New Issue
Block a user