mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 04:25:14 +01:00
Fixes
This commit is contained in:
parent
918b728767
commit
ef91e8ccb5
@ -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"),
|
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_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"),
|
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"),
|
SERVER_ECONOMY_ACCOUNT("", "The economy account which Admin Shops should use and to which all taxes will go"),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Listeners.PostTransaction;
|
package com.Acrobot.ChestShop.Listeners.PostTransaction;
|
||||||
|
|
||||||
import com.Acrobot.ChestShop.Config.Config;
|
import com.Acrobot.ChestShop.Config.Config;
|
||||||
import com.Acrobot.ChestShop.Config.Property;
|
|
||||||
import com.Acrobot.ChestShop.Events.TransactionEvent;
|
import com.Acrobot.ChestShop.Events.TransactionEvent;
|
||||||
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||||
@ -12,6 +11,9 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
* @author Acrobot
|
||||||
*/
|
*/
|
||||||
@ -23,7 +25,7 @@ public class EmptyShopDeleter implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shopShouldBeRemoved(event.getOwnerInventory())) {
|
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());
|
Chest connectedChest = uBlock.findConnectedChest(event.getSign());
|
||||||
connectedChest.getBlock().setType(Material.AIR);
|
connectedChest.getBlock().setType(Material.AIR);
|
||||||
}
|
}
|
||||||
@ -34,7 +36,7 @@ public class EmptyShopDeleter implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean shopShouldBeRemoved(Inventory inventory) {
|
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) {
|
public static boolean isEmpty(Inventory inventory) {
|
||||||
|
@ -41,7 +41,6 @@ public class ChestShopSign {
|
|||||||
|
|
||||||
public static boolean isValid(String[] line) {
|
public static boolean isValid(String[] line) {
|
||||||
return isValidPreparedSign(line) && (line[2].toUpperCase().contains("B") || line[2].toUpperCase().contains("S")) && !line[0].isEmpty();
|
return isValidPreparedSign(line) && (line[2].toUpperCase().contains("B") || line[2].toUpperCase().contains("S")) && !line[0].isEmpty();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValid(Block sign) {
|
public static boolean isValid(Block sign) {
|
||||||
|
@ -2,7 +2,7 @@ name: ChestShop
|
|||||||
|
|
||||||
main: com.Acrobot.ChestShop.ChestShop
|
main: com.Acrobot.ChestShop.ChestShop
|
||||||
|
|
||||||
version: 3.50t0003
|
version: 3.50t0004
|
||||||
|
|
||||||
#for CButD
|
#for CButD
|
||||||
dev-url: http://dev.bukkit.org/server-mods/chestshop/
|
dev-url: http://dev.bukkit.org/server-mods/chestshop/
|
||||||
|
Loading…
Reference in New Issue
Block a user