Package com.ranull.graves.compatibility
Class CompatibilityInventoryView
java.lang.Object
com.ranull.graves.compatibility.CompatibilityInventoryView
Handles Compatibility for InventoryView to prevent runtime errors on versions older than 1.21. Thanks to Rumsfield's code
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
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.
-