mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Add maximum-price for shop
Former-commit-id: bb08835310ecb41074de9d8328606a972243ac72 [formerly 870e44e2f9090b8bb3b8ff2f4dca0783be835b3b] Former-commit-id: b89472b60838ca3bbe7c65730f1d27a0317d0b9a
This commit is contained in:
1 parent
bb0d4fe90e
commit
c8eda51fe4
6 files changed
+33
-3
No files matched your search
@@ -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");
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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<Double, Double> priceRestriction = Util.getPriceRestriction(info.getItem().getType());
|
||||
if (priceRestriction != null) {
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
@@ -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.<itemID> can bypass it
|
||||
|
||||
@@ -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:"
|
||||
|
||||
Reference in new issue
Block a user