This commit is contained in:
Acrobot 2012-08-24 21:03:41 +02:00
parent 918b728767
commit ef91e8ccb5
4 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,7 @@ public enum Property {
ALLOW_LEFT_CLICK_DESTROYING(true, "If true, if you left-click your own shop sign you won't open chest's inventory, but instead you will start destroying the sign.\n"),
REMOVE_EMPTY_SHOPS(false, "If true, if the shop is empty, the sign is destroyed and put into the chest, so the shop isn't usable anymore.\n"),
REMOVE_EMPTY_CHESTS(false, "If true, if the REMOVE_EMPTY_SHOPS option is turned on, the chest is also destroyed."),
ADMIN_SHOP_NAME("Admin Shop", "First line of your Admin Shop's sign should look like this"),
SERVER_ECONOMY_ACCOUNT("", "The economy account which Admin Shops should use and to which all taxes will go"),

View File

@ -1,7 +1,6 @@
package com.Acrobot.ChestShop.Listeners.PostTransaction;
import com.Acrobot.ChestShop.Config.Config;
import com.Acrobot.ChestShop.Config.Property;
import com.Acrobot.ChestShop.Events.TransactionEvent;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
import com.Acrobot.ChestShop.Utils.uBlock;
@ -12,6 +11,9 @@ import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import static com.Acrobot.ChestShop.Config.Property.REMOVE_EMPTY_CHESTS;
import static com.Acrobot.ChestShop.Config.Property.REMOVE_EMPTY_SHOPS;
/**
* @author Acrobot
*/
@ -23,7 +25,7 @@ public class EmptyShopDeleter implements Listener {
}
if (shopShouldBeRemoved(event.getOwnerInventory())) {
if (!ChestShopSign.isAdminShop(event.getSign())) {
if (Config.getBoolean(REMOVE_EMPTY_CHESTS) && !ChestShopSign.isAdminShop(event.getSign())) {
Chest connectedChest = uBlock.findConnectedChest(event.getSign());
connectedChest.getBlock().setType(Material.AIR);
}
@ -34,7 +36,7 @@ public class EmptyShopDeleter implements Listener {
}
private static boolean shopShouldBeRemoved(Inventory inventory) {
return Config.getBoolean(Property.REMOVE_EMPTY_SHOPS) && isEmpty(inventory);
return Config.getBoolean(REMOVE_EMPTY_SHOPS) && isEmpty(inventory);
}
public static boolean isEmpty(Inventory inventory) {

View File

@ -41,7 +41,6 @@ public class ChestShopSign {
public static boolean isValid(String[] line) {
return isValidPreparedSign(line) && (line[2].toUpperCase().contains("B") || line[2].toUpperCase().contains("S")) && !line[0].isEmpty();
}
public static boolean isValid(Block sign) {

View File

@ -2,7 +2,7 @@ name: ChestShop
main: com.Acrobot.ChestShop.ChestShop
version: 3.50t0003
version: 3.50t0004
#for CButD
dev-url: http://dev.bukkit.org/server-mods/chestshop/