Updates Spigot, and fixes depreciated code
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-05-04 02:46:46 +02:00
parent 44f8bb36b0
commit 7e5525bd00
13 changed files with 38 additions and 338 deletions

View File

@@ -3,7 +3,9 @@ package net.knarcraft.blacksmith.util;
import net.knarcraft.blacksmith.config.SettingValueType;
import net.knarcraft.blacksmith.config.SmithPreset;
import net.knarcraft.blacksmith.config.SmithPresetFilter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Registry;
import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.NotNull;
@@ -82,8 +84,13 @@ public final class TabCompleteValuesHelper {
* @return <p>A complete list of enchantments</p>
*/
private static @NotNull List<String> getAllEnchantments() {
Registry<Enchantment> enchantmentRegistry = Bukkit.getRegistry(Enchantment.class);
if (enchantmentRegistry == null) {
throw new RuntimeException("Unable to get the enchantment registry");
}
List<String> enchantments = new ArrayList<>();
for (Enchantment enchantment : Enchantment.values()) {
for (Enchantment enchantment : enchantmentRegistry) {
enchantments.add(enchantment.getKey().getKey());
}
return enchantments;