so://phie

poppy

A feature-rich Minecraft plugin which enhances gaming experience
git clone git://soophie.de/poppy

blob: 65111b5884613576e2289f718e3c30831cc5de43 (639 bytes)[doc][blame][raw]

1package de.typable.minecrafthub.util;

2

3import org.bukkit.Material;

4import org.bukkit.inventory.Inventory;

5import org.bukkit.inventory.ItemStack;

6

7public class Util

8{

9 public static boolean isEmpty(ItemStack item)

10 {

11 return item == null || item.getType() == Material.AIR;

12 }

13

14 public static boolean isInventoryFull(Inventory inventory, ItemStack result)

15 {

16 for(ItemStack item : inventory.getContents())

17 {

18 if(Util.isEmpty(item))

19 {

20 return false;

21 }

22

23 if(result.isSimilar(item))

24 {

25 if(result.getAmount() + item.getAmount() <= item.getMaxStackSize())

26 {

27 return false;

28 }

29 }

30 }

31

32 return true;

33 }

34}