diff --git a/src/main/java/com/songoda/ultimatestacker/entity/EntityStack.java b/src/main/java/com/songoda/ultimatestacker/entity/EntityStack.java index 9c442f7..9c0d9d0 100644 --- a/src/main/java/com/songoda/ultimatestacker/entity/EntityStack.java +++ b/src/main/java/com/songoda/ultimatestacker/entity/EntityStack.java @@ -175,10 +175,13 @@ public class EntityStack { } } + static final int metaCarryOverMin = Settings.META_CARRY_OVER_MIN.getInt() * 20; + public Map getMetadata(LivingEntity subject) { Map v = new HashMap<>(); + if (subject.getTicksLived() >= metaCarryOverMin) return v; - Map> metadataMap = null; + Map> metadataMap = null; try { Object entityMetadata = methodGetEntityMetadata.invoke(Bukkit.getServer()); metadataMap = (Map) fieldMetadataMap.get(entityMetadata); diff --git a/src/main/java/com/songoda/ultimatestacker/settings/Settings.java b/src/main/java/com/songoda/ultimatestacker/settings/Settings.java index 428daae..34ccfaa 100644 --- a/src/main/java/com/songoda/ultimatestacker/settings/Settings.java +++ b/src/main/java/com/songoda/ultimatestacker/settings/Settings.java @@ -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",