minor adjustments

This commit is contained in:
xGinko 2023-09-29 13:26:36 +02:00
parent 20b5b724c5
commit d1f9d1a919
3 changed files with 16 additions and 17 deletions

View File

@ -25,10 +25,10 @@ public final class WrappedVillager {
}
/**
* @return True if the villager is optimized by the plugin, otherwise false.
* @return True if the villager is optimized by this or another plugin, otherwise false.
*/
public boolean isOptimized() {
return dataContainer.has(Keys.OPTIMIZATION_TYPE.key());
return dataContainer.has(Keys.OPTIMIZATION_TYPE.key()) || !villager.isAware() || !villager.hasAI();
}
/**

View File

@ -28,7 +28,6 @@ public class Config {
"If set to true, will display messages based on client language");
this.cache_keep_time_seconds = getInt("general.cache-keep-time-seconds", 30,
"The amount of time in seconds a villager will be kept in the plugin's cache.");
this.addComment("", "");
}
private ConfigFile loadConfig(File ymlFile) throws Exception {
@ -51,14 +50,14 @@ public class Config {
private void structureConfig() {
config.addDefault("config-version", 1.00);
createTitledSection("General", "general");
createTitledSection("Optimization Methods", "optimization-methods");
addComment("optimization-methods", """
BE AWARE:\s
It is recommended to choose preferably one (no more than 2) of the below methods, as this can\s
get confusing and depending on your config exploitable otherwise.
""");
createTitledSection("Optimization", "optimization-methods");
config.addDefault("optimization-methods.commands.unoptimizevillagers", null);
config.addDefault("optimization-methods.nametag-optimization.enable", true);
addComment("optimization-methods", """
BE AWARE:\s
It is recommended to choose preferably ONE, no more than TWO of the below methods, as it can\s
become confusing and - depending on your config - exploitable otherwise.
""");
createTitledSection("Villager Chunk Limit", "villager-chunk-limit");
createTitledSection("Gameplay", "gameplay");
config.addDefault("gameplay.villagers-spawn-as-adults.enable", false);

View File

@ -27,16 +27,16 @@ public class PreventVillagerDamage implements VillagerOptimizerModule, Listener
Config config = VillagerOptimizer.getConfiguration();
config.addComment("gameplay.prevent-damage.enable",
"Configure what kind of damage you want to cancel for optimized villagers here.");
this.block = config.getBoolean("gameplay.prevent-damage.block", false,
"Prevents damage from blocks like lava, tnt, respawn anchors, etc.");
this.player = config.getBoolean("gameplay.prevent-damage.player", false,
"Prevents damage from getting hit by players.");
this.mob = config.getBoolean("gameplay.prevent-damage.mob", true,
"Prevents damage from hostile mobs.");
this.other = config.getBoolean("gameplay.prevent-damage.other", true,
"Prevents damage from all other entities.");
this.push = config.getBoolean("gameplay.prevent-damage.prevent-push-from-attack", true,
"Prevents optimized villagers from getting pushed by an attacking entity");
this.block = config.getBoolean("gameplay.prevent-damage.damagers.block", false,
"Prevents damage from blocks like lava, tnt, respawn anchors, etc.");
this.player = config.getBoolean("gameplay.prevent-damage.damagers.player", false,
"Prevents damage from getting hit by players.");
this.mob = config.getBoolean("gameplay.prevent-damage.damagers.mob", true,
"Prevents damage from hostile mobs.");
this.other = config.getBoolean("gameplay.prevent-damage.damagers.other", true,
"Prevents damage from all other entities.");
}
@Override