diff --git a/src/main/java/org/maxgamer/quickshop/Command/QS.java b/src/main/java/org/maxgamer/quickshop/Command/QS.java index 657e0da49..9fc289faa 100644 --- a/src/main/java/org/maxgamer/quickshop/Command/QS.java +++ b/src/main/java/org/maxgamer/quickshop/Command/QS.java @@ -518,6 +518,13 @@ public class QS implements CommandExecutor{ sender.sendMessage(MsgUtil.getMessage("price-too-cheap")); return; } + double price_limit = plugin.getConfig().getInt("shop.maximum-price"); + if(price_limit!=-1){ + if(price > price_limit){ + p.sendMessage(MsgUtil.getMessage("price-too-high")); + return; + } + } double fee = 0; if (plugin.priceChangeRequiresFee) { fee = plugin.getConfig().getDouble("shop.fee-for-price-change"); diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 52328608d..cc27ca689 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -775,7 +775,13 @@ public class QuickShop extends JavaPlugin { saveConfig(); reloadConfig(); } - + if (selectedVersion == 20) { + getConfig().set("shop.maximum-price", -1); + getConfig().set("config-version", 21); + selectedVersion = 21; + saveConfig(); + reloadConfig(); + } } /** Reloads QuickShops config */ diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index 20e5caa55..db464b3e3 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -586,6 +586,7 @@ 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")) { @@ -611,6 +612,13 @@ public class ShopManager { p.sendMessage(MsgUtil.getMessage("price-too-cheap")); return; } + double price_limit = plugin.getConfig().getInt("shop.maximum-price"); + if(price_limit!=-1){ + if(price > price_limit){ + p.sendMessage(MsgUtil.getMessage("price-too-high")); + return; + } + } // Check price restriction Entry priceRestriction = Util.getPriceRestriction(info.getItem().getType()); if (priceRestriction != null) { diff --git a/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java b/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java index 1d8ab5d74..63095e5cd 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java +++ b/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java @@ -198,6 +198,12 @@ public class MsgUtil { selectedVersion = 10; messagei18n.save(messageFile); } + if (selectedVersion == 10) { + messagei18n.set("price-too-high", "&cShop price too high! You can't create price higher than {0} shop."); + messagei18n.set("language-version", 11); + selectedVersion = 11; + messagei18n.save(messageFile); + } } public static void sendControlPanelInfo(CommandSender sender, Shop shop) { if (!sender.hasPermission("quickshop.use")) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ed5eab8db..cd0ec47ea 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,7 +1,7 @@ #Default config: https://github.com/Ghost-chu/QuickShop-Reremake/blob/master/src/main/resources/config.yml #Do not touch if you not clear know about this -config-version: 21 +config-version: 22 #Select language you want use, (e.g de), use `default` to let quickshop auto detect your computer language zone, or use other exist language to override it. #After you use new language override it, you need delete `messages.yml` to let plugin regen your language file. @@ -135,6 +135,8 @@ shop: #Allow create shop in the sign cannot placed environment (e.g Player no permission put sign on that location / No enough space) allow-shop-without-space-for-sign: false + #The maximum price for shop, This not affect exists shops, set -1 to disable it. + maximum-price: -1 #List of items to disallow selling of. Anyone with quickshop.bypass. can bypass it diff --git a/src/main/resources/messages-en_US.yml b/src/main/resources/messages-en_US.yml index 89254074a..bace6cd31 100644 --- a/src/main/resources/messages-en_US.yml +++ b/src/main/resources/messages-en_US.yml @@ -11,7 +11,7 @@ translation-version: "&c&lSupport Version: &b&lReremake 1.2.5.2" translation-country: "&c&lLanguage Zone: &b&lEnglish (en_US)" # ====================================================================== -language-version: 10 +language-version: 11 not-looking-at-shop: "&cNo QuickShop found. You must be looking at one." no-anythings-in-your-hand: "&cNo anythings in your hand." @@ -64,6 +64,7 @@ break-shop-use-supertool: "&eYou break the shop by use SuperTool." failed-to-put-sign: "&cNo enough space around the shop to place infomation sign." failed-to-paste: "&cFailed upload data to Pastebin, Check the internet and try again. (See console for details)" warn-to-paste: "&eCollecting data and upload to Pastebin, this may need a while. &c&lWarning&c, The data is keep public one week, it may leak your server configuration, make sure you only send it to your <rusted staff/developer." +price-too-high: "&cShop price too high! You can't create price higher than {0} shop." menu: successful-purchase: "&aSuccessfully Purchased:" successfully-sold: "&aSuccessfully Sold:"