Class CompatibilityInventoryView

java.lang.Object
com.ranull.graves.compatibility.CompatibilityInventoryView

public class CompatibilityInventoryView extends Object
Handles Compatibility for InventoryView to prevent runtime errors on versions older than 1.21. Thanks to Rumsfield's code
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.Inventory
    getBottomInventory(org.bukkit.event.inventory.InventoryEvent event)
    In API versions 1.20.6 and earlier, InventoryView is a class.
    static org.bukkit.inventory.Inventory
    getBottomInventory(org.bukkit.inventory.InventoryView inventoryView)
    In API versions 1.20.6 and earlier, InventoryView is a class.
    static org.bukkit.inventory.Inventory
    getTopInventory(org.bukkit.event.inventory.InventoryEvent event)
    In API versions 1.20.6 and earlier, InventoryView is a class.
    static org.bukkit.inventory.Inventory
    getTopInventory(org.bukkit.inventory.InventoryView inventoryView)
    In API versions 1.20.6 and earlier, InventoryView is a class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CompatibilityInventoryView

      public CompatibilityInventoryView()
  • Method Details

    • getTopInventory

      public static org.bukkit.inventory.Inventory getTopInventory(org.bukkit.event.inventory.InventoryEvent event)
      In API versions 1.20.6 and earlier, InventoryView is a class. In versions 1.21 and later, it is an interface. This method uses reflection to get the top Inventory object from the InventoryView associated with an InventoryEvent, to avoid runtime errors.
      Parameters:
      event - The generic InventoryEvent with an InventoryView to inspect.
      Returns:
      The top Inventory object from the event's InventoryView.
    • getBottomInventory

      public static org.bukkit.inventory.Inventory getBottomInventory(org.bukkit.event.inventory.InventoryEvent event)
      In API versions 1.20.6 and earlier, InventoryView is a class. In versions 1.21 and later, it is an interface. This method uses reflection to get the top Inventory object from the InventoryView associated with an InventoryEvent, to avoid runtime errors.
      Parameters:
      event - The generic InventoryEvent with an InventoryView to inspect.
      Returns:
      The bottom Inventory object from the event's InventoryView.
    • getTopInventory

      public static org.bukkit.inventory.Inventory getTopInventory(org.bukkit.inventory.InventoryView inventoryView)
      In API versions 1.20.6 and earlier, InventoryView is a class. In versions 1.21 and later, it is an interface. This method uses reflection to get the top Inventory object from the InventoryView, to avoid runtime errors.
      Parameters:
      inventoryView - The InventoryView to inspect.
      Returns:
      The top Inventory object from the event's InventoryView.
    • getBottomInventory

      public static org.bukkit.inventory.Inventory getBottomInventory(org.bukkit.inventory.InventoryView inventoryView)
      In API versions 1.20.6 and earlier, InventoryView is a class. In versions 1.21 and later, it is an interface. This method uses reflection to get the bottom Inventory object from the InventoryView, to avoid runtime errors.
      Parameters:
      inventoryView - The InventoryView to inspect.
      Returns:
      The bottom Inventory object from the event's InventoryView.