diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-03 13:38:25 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-03 13:38:25 +0000 |
commit | 8539f281460d4a62362cc9a19fbbd65771b6dbdd (patch) | |
tree | 7efd24df0238a7d85022b569622b3e611ed799b7 | |
parent | 0b92c89ad7a28262e018f8638b07438b54d7ec1a (diff) | |
download | Essentials-8539f281460d4a62362cc9a19fbbd65771b6dbdd.tar Essentials-8539f281460d4a62362cc9a19fbbd65771b6dbdd.tar.gz Essentials-8539f281460d4a62362cc9a19fbbd65771b6dbdd.tar.lz Essentials-8539f281460d4a62362cc9a19fbbd65771b6dbdd.tar.xz Essentials-8539f281460d4a62362cc9a19fbbd65771b6dbdd.zip |
[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
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java index 621fe73e8..9908a960d 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoPlayerListener.java @@ -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) |