mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-26 20:16:12 +01:00
Put the correct sign type into the chest on empty remove (Fixes #313)
This commit is contained in:
parent
e22a50e1cf
commit
d868fe8af6
@ -42,12 +42,22 @@ public class EmptyShopDeleter implements Listener {
|
||||
ShopDestroyedEvent destroyedEvent = new ShopDestroyedEvent(null, event.getSign(), connectedContainer);
|
||||
ChestShop.callEvent(destroyedEvent);
|
||||
|
||||
Material signType = sign.getType();
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
|
||||
if (Properties.REMOVE_EMPTY_CHESTS && !ChestShopSign.isAdminShop(ownerInventory) && InventoryUtil.isEmpty(ownerInventory)) {
|
||||
connectedContainer.getBlock().setType(Material.AIR);
|
||||
} else {
|
||||
ownerInventory.addItem(new ItemStack(Material.SIGN, 1));
|
||||
if (!signType.isItem()) {
|
||||
try {
|
||||
signType = Material.valueOf(signType.name().replace("WALL_", ""));
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
}
|
||||
if (signType.isItem()) {
|
||||
ownerInventory.addItem(new ItemStack(signType, 1));
|
||||
} else {
|
||||
ChestShop.getBukkitLogger().warning("Unable to get item for sign " + signType + " to add to removed shop's container!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user