summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-11-14 10:11:23 +0000
committerKHobbits <rob@khobbits.co.uk>2011-11-14 10:11:23 +0000
commitb619a54105d93319f6adfbacecf5ac892ce66734 (patch)
tree8a73065994755a4ce7be4e747a8702f74ec3584d
parentcd897890be57a6162ee0281a476de3f58f998882 (diff)
downloadEssentials-b619a54105d93319f6adfbacecf5ac892ce66734.tar
Essentials-b619a54105d93319f6adfbacecf5ac892ce66734.tar.gz
Essentials-b619a54105d93319f6adfbacecf5ac892ce66734.tar.lz
Essentials-b619a54105d93319f6adfbacecf5ac892ce66734.tar.xz
Essentials-b619a54105d93319f6adfbacecf5ac892ce66734.zip
Prevent client crash on 'Free air'
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignFree.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
index 8939f4bea..8a7c27fe7 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
@@ -4,7 +4,9 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.InventoryWorkaround;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import net.minecraft.server.InventoryPlayer;
+import org.bukkit.Material;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.inventory.ItemStack;
@@ -27,6 +29,11 @@ public class SignFree extends EssentialsSign
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
final ItemStack item = getItemStack(sign.getLine(1), 1, ess);
+ if (item.getType() == Material.AIR)
+ {
+ throw new SignException(Util.format("cantSpawnItem", "Air"));
+ }
+
item.setAmount(item.getType().getMaxStackSize()*9*4);
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(player.getHandle()));
inv.clear();