Fix #267

Former-commit-id: 789e2edc8c3ce015ec1cccade6a0738648e531f0
This commit is contained in:
Ghost_chu authored and GitHub committed 2019-12-28 18:01:50 +08:00
1 parent 6febb5c1cb
commit a95b32ea84
1 file changed
+12 -4
@@ -159,9 +159,9 @@ public class ShopProtectionListener implements Listener {
return;
}
final HashMap<Location, Shop> shopsInChunk = plugin.getShopManager().getShops(loc.getChunk());
final Shop shop = plugin.getShopManager().getShopIncludeAttached(loc)
if (shopsInChunk == null || shopsInChunk.isEmpty() || shopsInChunk.get(loc) == null) {
if (shop == null) {
return;
}
@@ -172,9 +172,17 @@ public class ShopProtectionListener implements Listener {
if (location == null) {
return;
}
final InventoryHolder holder = event.getInitiator().getHolder();
if(holder instanceof Entity){
holder.remove();
}else if(holder instanceof Block){
location.getBlock().breakNaturally();
}
location.getBlock().breakNaturally();
MsgUtil.sendGlobalAlert("[DisplayGuard] Breaked the block at " + location + " try steal the items for shop " + loc);
MsgUtil.sendGlobalAlert("[DisplayGuard] Defened a item steal action at" + location);
}
//Protect Entity pickup shop