Class BukkitUtils

java.lang.Object
ch.njol.skript.bukkitutil.BukkitUtils

public class BukkitUtils extends Object
Utility class with methods pertaining to Bukkit API
  • Constructor Details

    • BukkitUtils

      public BukkitUtils()
  • Method Details

    • registryExists

      public static boolean registryExists(String registry)
      Check if a registry exists
      Parameters:
      registry - Registry to check for (Fully qualified name of registry)
      Returns:
      True if registry exists else false
    • getPotionEffectTypeRegistry

      @Nullable public static @Nullable org.bukkit.Registry<org.bukkit.potion.PotionEffectType> getPotionEffectTypeRegistry()
      Get an instance of the PotionEffectType Registry

      Paper/Bukkit have 2 different names for the same registry.

      Returns:
      PotionEffectType Registry
    • getEquipmentSlotIndex

      public static Integer getEquipmentSlotIndex(org.bukkit.inventory.EquipmentSlot equipmentSlot)
      Get the inventory slot index of the EquipmentSlot
      Parameters:
      equipmentSlot - The equipment slot to get the index of
      Returns:
      The equipment slot index of the provided slot, otherwise null if invalid
    • getEquipmentSlotFromIndex

      public static org.bukkit.inventory.EquipmentSlot getEquipmentSlotFromIndex(int slotIndex)
      Get the EquipmentSlot represented by the inventory slot index
      Parameters:
      slotIndex - The index of the equipment slot
      Returns:
      The equipment slot the provided slot index, otherwise null if invalid
    • getRegistryClassInfo

      @Nullable public static <R extends org.bukkit.Keyed> @Nullable RegistryClassInfo<?> getRegistryClassInfo(String classPath, String registryName, String codeName, String languageNode)
      Gets a RegistryClassInfo by checking if the Class from classPath exists and Registry or RegistryKey contains registryName.
      Parameters:
      classPath - The String representation of the desired Class.
      registryName - The String representation of the desired Registry.
      codeName - The name used in patterns.
      languageNode - The language node of the type.
      Returns:
      RegistryClassInfo if the class and registry exists, otherwise null.