mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02:00
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:
@@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -74,7 +75,11 @@ public class EssentialsEcoBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
else if (i1 != null)
|
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)
|
if (m2)
|
||||||
@@ -83,8 +88,13 @@ public class EssentialsEcoBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
else if (i2 != null)
|
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);
|
sign.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user