summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-22 21:43:47 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-22 21:43:47 +0000
commite2c06506bc326a2d95b1d95ef9038d391317b5f4 (patch)
tree18107ff0dfe3432d54679b9453a002a7e46c40c1
parent2ca88187c446efcd11264e666e4037ed5989d0fb (diff)
downloadEssentials-e2c06506bc326a2d95b1d95ef9038d391317b5f4.tar
Essentials-e2c06506bc326a2d95b1d95ef9038d391317b5f4.tar.gz
Essentials-e2c06506bc326a2d95b1d95ef9038d391317b5f4.tar.lz
Essentials-e2c06506bc326a2d95b1d95ef9038d391317b5f4.tar.xz
Essentials-e2c06506bc326a2d95b1d95ef9038d391317b5f4.zip
Add stuff directly to inventory to prevent theft by standing next to the sign, while someone breaks it.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1526 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
index 10ec0438d..113ad327a 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
@@ -74,7 +75,11 @@ public class EssentialsEcoBlockListener extends BlockListener
}
else if (i1 != null)
{
- InventoryWorkaround.dropItem(user.getLocation(), i1);
+ Map<Integer, ItemStack> leftOver = user.getInventory().addItem(i1);
+ for (ItemStack itemStack : leftOver.values())
+ {
+ InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ }
}
if (m2)
@@ -83,8 +88,13 @@ public class EssentialsEcoBlockListener extends BlockListener
}
else if (i2 != null)
{
- InventoryWorkaround.dropItem(user.getLocation(), i2);
+ Map<Integer, ItemStack> leftOver = user.getInventory().addItem(i2);
+ for (ItemStack itemStack : leftOver.values())
+ {
+ InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ }
}
+ user.updateInventory();
sign.setType(Material.AIR);
}