mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-27 17:52:06 +01:00
Prevent client crash on 'Free air'
This commit is contained in:
parent
cd897890be
commit
b619a54105
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user