Fix bug and add "disable-vault-format" feature.

Former-commit-id: 4590c0c2c2509748dcaafe3f9db1d485d6d5b9a5 [formerly 1be4079fd0162be04035e1d276df9ed3ca0d9e9b]
Former-commit-id: 06a74d28c55a365e5532022d4cdfef0b440ed569
This commit is contained in:
Ghost_chu committed 2019-03-09 14:48:39 +08:00
1 parent cb4a279b83
commit bbb89e08c5
5 files changed
+29 -6

No files matched your search

@@ -760,6 +760,14 @@ public class QuickShop extends JavaPlugin {
saveConfig();
reloadConfig();
}
if (selectedVersion == 18) {
getConfig().set("shop.disable-vault-format", false);
getConfig().set("config-version", 19);
selectedVersion = 19;
saveConfig();
reloadConfig();
}
}
/** Reloads QuickShops config */
@@ -176,14 +176,15 @@ public class ContainerShop implements Shop {
}
/**
* Sets the price of the shop. Does not update it in the database. Use
* shop.update() for that.
* Sets the price of the shop.
*
* @param price
* The new price of the shop.
*/
public void setPrice(double price) {
this.price = price;
update();
Util.debugLog("New price is applyed to shop: "+String.valueOf(price));
}
/**
@@ -422,11 +423,11 @@ public class ContainerShop implements Shop {
* Changes the owner of this shop to the given player.
*
* @param owner
* The name of the owner. You must do shop.update() after to save
* it after a reboot.
*/
public void setOwner(UUID owner) {
this.owner = owner;
update();
Util.debugLog("New owner is applyed to shop: "+owner.toString());
}
/**
@@ -440,6 +441,8 @@ public class ContainerShop implements Shop {
public void setUnlimited(boolean unlimited) {
this.unlimited = unlimited;
update();
Util.debugLog("New unlimited mode is applyed to shop: "+String.valueOf(unlimited));
}
public boolean isUnlimited() {
@@ -467,6 +470,8 @@ public class ContainerShop implements Shop {
public void setShopType(ShopType shopType) {
this.shopType = shopType;
this.setSignText();
update();
Util.debugLog("New shopType is applyed to shop: "+shopType.toString());
}
/**
@@ -496,6 +501,8 @@ public class ContainerShop implements Shop {
lines[2] = MsgUtil.getMessage("signs.item", Util.getNameForSign(this.item));
lines[3] = MsgUtil.getMessage("signs.price", Util.format(this.getPrice()));
this.setSignText(lines);
Util.debugLog("New sign was setuped.");
Util.debugLog(lines.toString());
}
/**
@@ -447,6 +447,9 @@ public class Util {
* @return The formatted string.
*/
public static String format(double n) {
if(plugin.getConfig().getBoolean("shop.disable-vault-format")) {
return plugin.getConfig().getString("shop.alternate-currency-symbol") + n;
}
try {
String formated = plugin.getEcon().format(n);
if (formated == null || formated.isEmpty()) {
+6 -1
View File
@@ -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: 18
config-version: 19
#Do not touch if you not know what is this
dev-mode: false
@@ -110,6 +110,10 @@ shop:
#If vault not return coins symbol, QuickShop will use this symbol to replace it.
alternate-currency-symbol: '$'
#It should can fix Vault or economy not correctly process the price and return "0" result problem.
#If you turn on this option, plugin will force use "alternate-currency-symbol" option.
disable-vault-format: false
#Ignore trade messages if shop is unlimited
ignore-unlimited-shop-messages: false
@@ -121,6 +125,7 @@ shop:
auto-fetch-shop-messages: true
#Ignore cancel chat event, maybe can improve compatibility with other chat plugin.
ignore-cancel-chat-event: false
#List of items to disallow selling of. Anyone with quickshop.bypass.<itemID> can bypass it