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
This commit is contained in:
snowleo 2011-05-22 21:43:47 +00:00
parent 2ca88187c4
commit e2c06506bc

View File

@ -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);
}