Disable meta carry over on grinders to improve performance.

This commit is contained in:
Brianna 2020-05-08 17:04:01 -04:00
parent 86bf40cb74
commit 4aad7fa929
2 changed files with 11 additions and 1 deletions

View File

@ -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);

View File

@ -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",