Rewriten how dependency is handled

This commit is contained in:
alexcrea 2024-06-16 12:58:44 +02:00
parent b512d8f732
commit aad9974baf
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
10 changed files with 56 additions and 19 deletions

View file

@ -9,6 +9,7 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.alexcrea.cuanvil.dependency.DependencyManager;
import xyz.alexcrea.cuanvil.enchant.wrapped.VanillaEnchant;
import java.util.*;
@ -172,7 +173,7 @@ public abstract class WrappedEnchantment {
* @param item Item to get enchantment from.
* @return A map of the set enchantments and there's respective levels.
*/
public static Map<WrappedEnchantment, Integer> getEnchants(@NotNull ItemStack item){ //TODO faster method to find vanilla enchantment
public static Map<WrappedEnchantment, Integer> getEnchants(@NotNull ItemStack item){
Map<WrappedEnchantment, Integer> enchantments = new HashMap<>();
ItemMeta meta = item.getItemMeta();
@ -232,6 +233,10 @@ public abstract class WrappedEnchantment {
register(new VanillaEnchant(enchantment));
}
if(DependencyManager.INSTANCE.getEnchantmentSquaredCompatibility() != null){
DependencyManager.INSTANCE.getEnchantmentSquaredCompatibility().registerEnchantements();
}
}
/**

View file

@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.alexcrea.cuanvil.gui.config.global.*;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
import xyz.alexcrea.cuanvil.packet.PacketManager;
import xyz.alexcrea.cuanvil.dependency.protocolib.PacketManager;
import java.util.Collections;

View file

@ -18,7 +18,7 @@ import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
import xyz.alexcrea.cuanvil.packet.PacketManager;
import xyz.alexcrea.cuanvil.dependency.protocolib.PacketManager;
import java.util.ArrayList;
import java.util.Arrays;