diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/User.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 6038e8b1c..d7e3686ea 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -8,6 +8,7 @@ import com.earth2me.essentials.commands.IEssentialsCommand; import net.minecraft.server.EntityHuman; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.reader.UnicodeReader; @@ -696,4 +697,27 @@ public class User extends PlayerExtension implements Comparable<User> { return !Essentials.getSettings().itemSpawnBlacklist().contains(itemId); } + + public boolean hasUnlimited(ItemStack stack) { + if (!data.containsKey("unlimited")) { + return false; + } + @SuppressWarnings("unchecked") + List<Integer> items = (List<Integer>)data.get("unlimited"); + return items.contains(stack.getTypeId()); + } + + @SuppressWarnings("unchecked") + public void setUnlimited(ItemStack stack, boolean b) { + List<Integer> items = new ArrayList<Integer>(); + if (data.containsKey("unlimited")) { + items = (List<Integer>)data.get("unlimited"); + } + items.remove(stack.getTypeId()); + if (b) { + items.add(stack.getTypeId()); + } + data.put("unlimited", items); + flush(); + } } |