This commit is contained in:
xGinko 2024-01-25 15:46:59 +01:00
parent 305ccb0f0d
commit 604f16b5df
3 changed files with 21 additions and 11 deletions

View File

@ -87,9 +87,6 @@ public final class VillagerOptimizer extends JavaPlugin {
public static VillagerOptimizer getInstance() {
return instance;
}
public static NamespacedKey getKey(String key) {
return new NamespacedKey(instance, key);
}
public static Config getConfiguration() {
return config;
}

View File

@ -33,7 +33,7 @@ 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.support_other_plugins = getBoolean("general.support-avl-villagers", true, """
this.support_other_plugins = getBoolean("general.support-avl-villagers", false, """
Enable if you have previously used AntiVillagerLag (https://www.spigotmc.org/resources/antivillagerlag.102949/).\s
Tries to read pre-existing info like optimization state so players don't need to reoptimize their villagers.""");
}

View File

@ -8,25 +8,38 @@ import org.bukkit.plugin.Plugin;
import java.util.Locale;
public class Keys {
public enum Origin {
VillagerOptimizer,
AntiVillagerLag;
}
public enum Own {
OPTIMIZATION_TYPE(VillagerOptimizer.getKey("optimization-type")),
LAST_OPTIMIZE(VillagerOptimizer.getKey("last-optimize")),
LAST_LEVELUP(VillagerOptimizer.getKey("last-levelup")),
LAST_RESTOCK(VillagerOptimizer.getKey("last-restock")),
LAST_OPTIMIZE_NAME(VillagerOptimizer.getKey("last-optimize-name"));
OPTIMIZATION_TYPE("optimization-type"),
LAST_OPTIMIZE("last-optimize"),
LAST_LEVELUP("last-levelup"),
LAST_RESTOCK("last-restock"),
LAST_OPTIMIZE_NAME("last-optimize-name");
private final NamespacedKey key;
Own(NamespacedKey key) {
this.key = key;
Own(String key) {
this.key = getKey(key);
}
public NamespacedKey key() {
return key;
}
/**
* Returns a NamespacedKey created by VillagerOptimizer.
*
* @return a {@link NamespacedKey} that can be used to test for and read data stored by VillagerOptimizer
* from a {@link PersistentDataContainer}
*/
public static NamespacedKey getKey(String key) {
return new NamespacedKey(VillagerOptimizer.getInstance(), key);
}
}
public enum AntiVillagerLag {