0.2h Improve InventoryUtil
This commit is contained in:
parent
e2e5ad35cf
commit
f5682c354a
@ -60,19 +60,32 @@ public class InventoryUtil
|
|||||||
// EVENT INTERPRETATION
|
// EVENT INTERPRETATION
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static boolean isOutside(int rawSlot)
|
||||||
|
{
|
||||||
|
return rawSlot < 0;
|
||||||
|
}
|
||||||
|
public static boolean isTopInventory(int rawSlot, Inventory inventory)
|
||||||
|
{
|
||||||
|
if (isOutside(rawSlot)) return false;
|
||||||
|
return rawSlot < inventory.getSize();
|
||||||
|
}
|
||||||
|
public static boolean isBottomInventory(int rawSlot, Inventory inventory)
|
||||||
|
{
|
||||||
|
if (isOutside(rawSlot)) return false;
|
||||||
|
return rawSlot >= inventory.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isOutside(InventoryClickEvent event)
|
public static boolean isOutside(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
return event.getRawSlot() < 0;
|
return isOutside(event.getRawSlot());
|
||||||
}
|
}
|
||||||
public static boolean isTopInventory(InventoryClickEvent event)
|
public static boolean isTopInventory(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
if (isOutside(event)) return false;
|
return isTopInventory(event.getRawSlot(), event.getInventory());
|
||||||
return event.getRawSlot() < event.getInventory().getSize();
|
|
||||||
}
|
}
|
||||||
public static boolean isBottomInventory(InventoryClickEvent event)
|
public static boolean isBottomInventory(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
if (isOutside(event)) return false;
|
return isBottomInventory(event.getRawSlot(), event.getInventory());
|
||||||
return event.getRawSlot() >= event.getInventory().getSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
Loading…
Reference in New Issue
Block a user