remove obsolete allowUnsafeEnchants config option

This commit is contained in:
granny
2024-10-03 17:29:48 -07:00
parent 639bcbd780
commit bcf8103e4c
22 changed files with 68 additions and 61 deletions

View File

@@ -95,14 +95,13 @@ index 5f57f3494705ca1664dbca395c1af3280a50cad8..8c14f8c9f61baf1842e42b62bcd73717
return (ItemEnchantments) this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY);
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 3c1b41f0ae58669d6fae640e8763c43e74bd0239..e19346e82ace64d5439d2607709682a9381edfe7 100644
index 6fcb2db92a38e862da288518ce34d16aa4b856e0..e3371ff562b09f05ba0b865b5e301d03e398eee6 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -285,6 +285,29 @@ public class PurpurConfig {
@@ -285,6 +285,36 @@ public class PurpurConfig {
cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
}
+ public static boolean allowUnsafeEnchants = false;
+ public static boolean allowInapplicableEnchants = true;
+ public static boolean allowIncompatibleEnchants = true;
+ public static boolean allowHigherEnchantsLevels = true;
@@ -117,11 +116,19 @@ index 3c1b41f0ae58669d6fae640e8763c43e74bd0239..e19346e82ace64d5439d2607709682a9
+ set("settings.enchantment.anvil.allow-higher-enchants-levels", true);
+ set("settings.enchantment.allow-unsafe-enchants", null);
+ }
+ allowUnsafeEnchants = getBoolean("settings.enchantment.anvil.allow-unsafe-enchants", allowUnsafeEnchants);
+ if (version < 37) {
+ boolean allowUnsafeEnchants = getBoolean("settings.enchantment.anvil.allow-unsafe-enchants", false);
+ if (!allowUnsafeEnchants) {
+ set("settings.enchantment.anvil.allow-inapplicable-enchants", false);
+ set("settings.enchantment.anvil.allow-incompatible-enchants", false);
+ set("settings.enchantment.anvil.allow-higher-enchants-levels", false);
+ }
+ set("settings.enchantment.anvil.allow-unsafe-enchants", null);
+ }
+ allowInapplicableEnchants = getBoolean("settings.enchantment.anvil.allow-inapplicable-enchants", allowInapplicableEnchants);
+ allowIncompatibleEnchants = getBoolean("settings.enchantment.anvil.allow-incompatible-enchants", allowIncompatibleEnchants);
+ allowHigherEnchantsLevels = getBoolean("settings.enchantment.anvil.allow-higher-enchants-levels", allowHigherEnchantsLevels);
+ allowUnsafeEnchantCommand = getBoolean("settings.enchantment.allow-unsafe-enchant-command", allowUnsafeEnchants); // allowUnsafeEnchants as default for backwards compatability
+ allowUnsafeEnchantCommand = getBoolean("settings.enchantment.allow-unsafe-enchant-command", allowUnsafeEnchantCommand);
+ replaceIncompatibleEnchants = getBoolean("settings.enchantment.anvil.replace-incompatible-enchants", replaceIncompatibleEnchants);
+ }
+