From 7c67bac05196c3ec01129713da41b9d6681ab4f7 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 3 Apr 2011 13:38:25 +0000 Subject: [PATCH] [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 --- .../earth2me/essentials/EssentialsEcoPlayerListener.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 leftOver = user.getInventory().addItem(item); + for (ItemStack itemStack : leftOver.values()) { + user.getWorld().dropItem(user.getLocation(), itemStack); + } user.updateInventory(); } catch (Throwable ex)