Package ch.njol.skript.bukkitutil
Class BukkitUtils
java.lang.Object
ch.njol.skript.bukkitutil.BukkitUtils
Utility class with methods pertaining to Bukkit API
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.EquipmentSlotgetEquipmentSlotFromIndex(int slotIndex) Get theEquipmentSlotrepresented by the inventory slot indexstatic IntegergetEquipmentSlotIndex(org.bukkit.inventory.EquipmentSlot equipmentSlot) Get the inventory slot index of theEquipmentSlotstatic @Nullable org.bukkit.Registry<org.bukkit.potion.PotionEffectType> Get an instance of thePotionEffectTypeRegistrystatic <R extends org.bukkit.Keyed>
@Nullable RegistryClassInfo<?> getRegistryClassInfo(String classPath, String registryName, String codeName, String languageNode) Gets aRegistryClassInfoby checking if theClassfromclassPathexists andRegistryorRegistryKeycontainsregistryName.static booleanregistryExists(String registry) Check if a registry exists
-
Constructor Details
-
BukkitUtils
public BukkitUtils()
-
-
Method Details
-
registryExists
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 thePotionEffectTypeRegistryPaper/Bukkit have 2 different names for the same registry.
- Returns:
- PotionEffectType Registry
-
getEquipmentSlotIndex
Get the inventory slot index of theEquipmentSlot- 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 theEquipmentSlotrepresented 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 aRegistryClassInfoby checking if theClassfromclassPathexists andRegistryorRegistryKeycontainsregistryName.- Parameters:
classPath- TheStringrepresentation of the desiredClass.registryName- TheStringrepresentation of the desiredRegistry.codeName- The name used in patterns.languageNode- The language node of the type.- Returns:
RegistryClassInfoif the class and registry exists, otherwisenull.
-