mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-26 08:29:44 +00:00
[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:
parent
0b92c89ad7
commit
8539f28146
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.craftbukkit.block.CraftSign;
|
import org.bukkit.craftbukkit.block.CraftSign;
|
||||||
|
@ -33,7 +34,10 @@ public class EssentialsEcoPlayerListener extends PlayerListener
|
||||||
int cost = Integer.parseInt(sign.getLine(3).substring(1));
|
int cost = Integer.parseInt(sign.getLine(3).substring(1));
|
||||||
if (user.getMoney() < cost) throw new Exception("You do not have sufficient funds.");
|
if (user.getMoney() < cost) throw new Exception("You do not have sufficient funds.");
|
||||||
user.takeMoney(cost);
|
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();
|
user.updateInventory();
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
|
|
Loading…
Reference in a new issue