new config persistentdata.yml

This commit is contained in:
nossr50
2020-10-12 12:40:54 -07:00
parent 916eb76553
commit 29722511b7
5 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,37 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
public class PersistentDataConfig extends AutoUpdateConfigLoader {
private static PersistentDataConfig instance;
private PersistentDataConfig() {
super("persistentdata.yml");
validate();
}
public static PersistentDataConfig getInstance() {
if (instance == null) {
instance = new PersistentDataConfig();
}
return instance;
}
@Override
protected void loadKeys() {
//Sigh this old config system...
}
@Override
protected boolean validateKeys() {
return true;
}
//Persistent Data Toggles
public boolean isMobPersistent(MobMetaFlagType mobMetaFlagType) {
String key = "Persistent_Data.Mobs.Flags." + mobMetaFlagType.toString() + ".Saved_To_Disk";
return config.getBoolean(key, false);
}
}

View File

@ -21,10 +21,12 @@ import java.util.UUID;
public class SpigotPersistentDataLayer_1_14 extends AbstractPersistentDataLayer {
private final @NotNull EnumMap<MobMetaFlagType, NamespacedKey> mobFlagKeyMap;
private final @NotNull SpigotPersistentDataLayer_1_13 transientLayer;
public SpigotPersistentDataLayer_1_14() {
mobFlagKeyMap = new EnumMap<>(MobMetaFlagType.class);
initMobFlagKeyMap();
transientLayer = new SpigotPersistentDataLayer_1_13(); //For disabled persistent types
}
@Override

View File

@ -0,0 +1,29 @@
# This config allows servers to change which data is persistent and which data isn't
# For 10 years mcMMO had transient data (temporary) for a lot of things and recently in October 2020 I added the option to have things be persistent (saved to disk and permanently remembered)
# However, this is Minecraft, and Minecraft has a lot of entities, and when you start to make data persistent there is a performance cost associated with that
# Any option you turn on, is another thing your disk has to save when a chunk is being unloaded with that entity inside of it, Minecraft can quickly build up tens of thousands of entities so keep this in mind.
Persistent_Data:
Mobs:
Flags:
# By default mcMMO gives 0 XP for this type of mob, adjust in experience.yml
MOB_SPAWNER_MOB:
Saved_To_Disk: false
# By default mcMMO gives 0 XP for this type of mob, adjust in experience.yml
EGG_MOB:
Saved_To_Disk: false
# By default mcMMO gives 0 XP for this type of mob, adjust in experience.yml
NETHER_PORTAL_MOB:
Saved_To_Disk: false
# These mobs have low impact on performance and thus it is recommended you leave this on true
COTW_SUMMONED_MOB:
Saved_To_Disk: true
# By default mcMMO gives normal XP for player bred mobs, adjust in experience.yml
PLAYER_BRED_MOB:
Saved_To_Disk: false
# By default mcMMO gives 0 XP for this type of mob, due to an exploit in Minecraft you can spawn 1000 endermen in seconds using this trick.
# Adjust in experience.yml under the section labeled exploit fix
EXPLOITED_ENDERMEN:
Saved_To_Disk: false
# By default mcMMO gives 0 XP for this type of mob, not adjustable currently
PLAYER_TAMED_MOB:
Saved_To_Disk: false