[trunk] Drop items from Buy Signs if the inventory is full

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1099 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-03 13:38:25 +00:00
parent 0b92c89ad7
commit 8539f28146
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
@ -33,7 +34,10 @@ public class EssentialsEcoPlayerListener extends PlayerListener
int cost = Integer.parseInt(sign.getLine(3).substring(1));
if (user.getMoney() < cost) throw new Exception("You do not have sufficient funds.");
user.takeMoney(cost);
user.getInventory().addItem(item);
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(item);
for (ItemStack itemStack : leftOver.values()) {
user.getWorld().dropItem(user.getLocation(), itemStack);
}
user.updateInventory();
}
catch (Throwable ex)