Fix allow-shop-without-space-for-sign not working

Former-commit-id: 1d5d1fa98aa226ba7b2d5785d91fa65dbd13e398 [formerly 310544fc22bb6f55eff2666898ebd594053088b5]
Former-commit-id: 416ee8d640ac07011f598cd9e36a2901e42ce3bd
This commit is contained in:
Ghost_chu committed 2019-04-05 21:36:20 +08:00
1 parent bd6eace8d5
commit 95708546fc
2 files changed
+17 -16

No files matched your search

@@ -768,7 +768,7 @@ public class QuickShop extends JavaPlugin {
reloadConfig();
}
if (selectedVersion == 19) {
getConfig().set("allow-shop-without-space-for-sign", false);
getConfig().set("allow-shop-without-space-for-sign", true);
getConfig().set("config-version", 20);
selectedVersion = 20;
saveConfig();
@@ -578,7 +578,7 @@ public class ShopManager {
p.sendMessage(MsgUtil.getMessage("no-double-chests"));
return;
}
if (Util.canBeShop(info.getLocation().getBlock(),null,true) == false) {
if (Util.canBeShop(info.getLocation().getBlock(), null, true) == false) {
p.sendMessage(MsgUtil.getMessage("chest-was-removed"));
return;
}
@@ -586,6 +586,16 @@ public class ShopManager {
if (!p.hasPermission("quickshop.create.enderchest"))
return;
}
// allow-shop-without-space-for-sign check
if (plugin.getConfig().getBoolean("shop.auto-sign")
&& plugin.getConfig().getBoolean("allow-shop-without-space-for-sign")) {
Material signType = info.getSignBlock().getType();
if (info.getSignBlock() == null && signType != Material.AIR && signType != Material.CAVE_AIR
&& signType != Material.VOID_AIR && signType != Material.WATER) {
p.sendMessage(MsgUtil.getMessage("failed-to-put-sign"));
return;
}
}
// Price per item
double price;
if (plugin.getConfig().getBoolean("whole-number-prices-only")) {
@@ -625,16 +635,7 @@ public class ShopManager {
shop.onUnload();
return;
}
// allow-shop-without-space-for-sign check
if (plugin.getConfig().getBoolean("shop.auto-sign") && plugin.getConfig().getBoolean("no-space-to-put-sign")) {
Material signType = info.getSignBlock().getType();
if (info.getSignBlock() == null && signType != Material.AIR && signType != Material.CAVE_AIR && signType != Material.VOID_AIR && signType != Material.WATER) {
p.sendMessage(MsgUtil.getMessage("no-space-to-put-sign"));
return;
}
}
// This must be called after the event has been called.
// Else, if the event is cancelled, they won't get their
// money back.
@@ -645,17 +646,17 @@ public class ShopManager {
return;
}
try {
plugin.getEcon().deposit(Bukkit.getOfflinePlayer(plugin.getConfig().getString("tax-account")).getUniqueId(), tax);
plugin.getEcon().deposit(
Bukkit.getOfflinePlayer(plugin.getConfig().getString("tax-account")).getUniqueId(), tax);
} catch (Exception e2) {
e2.printStackTrace();
plugin.getLogger().log(Level.WARNING,
"QuickShop can't pay tax to account in config.yml,Please set tax account name to a exist player!");
}
}
/* The shop has hereforth been successfully created */
createShop(shop,info);
createShop(shop, info);
Location loc = shop.getLocation();
plugin.log(p.getName() + " created a " + MsgUtil.getDisplayName(shop.getItem()) + " shop at ("
+ loc.getWorld().getName() + " - " + loc.getX() + "," + loc.getY() + "," + loc.getZ() + ")");