mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
补全丢失的词条 修改金额格式化方式...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
f64af66f09
commit
56fd3f20ed
4
pom.xml
4
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.maxgamer</groupId>
|
<groupId>org.maxgamer</groupId>
|
||||||
<artifactId>QuickShop</artifactId>
|
<artifactId>QuickShop</artifactId>
|
||||||
<version>1.6.3.2</version>
|
<version>1.6.4</version>
|
||||||
<description>快捷商店重置版本...</description>
|
<description>快捷商店重置版本...</description>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||||
<update.description>&a修改扫描流程 &c修复设置玩家命令错误...</update.description>
|
<update.description>&b补全丢失的词条 &a修改金额格式化方式...</update.description>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -3,53 +3,91 @@ package org.maxgamer.QuickShop.Economy;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Economy implements EconomyCore {
|
public class Economy implements EconomyCore {
|
||||||
private EconomyCore core;
|
private final EconomyCore core;
|
||||||
|
|
||||||
public Economy(EconomyCore core) {
|
public Economy(final EconomyCore core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Checks that this economy is valid. Returns false if it is not valid.
|
public String currencyNamePlural() {
|
||||||
*
|
return this.core.currencyNamePlural();
|
||||||
* @return True if this economy will work, false if it will not.
|
|
||||||
*/
|
|
||||||
public boolean isValid() {
|
|
||||||
return core.isValid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deposits a given amount of money from thin air to the given username.
|
* Deposits a given amount of money from thin air to the given username.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The exact (case insensitive) username to give money to
|
* The exact (case insensitive) username to give money to
|
||||||
* @param amount
|
* @param amount
|
||||||
* The amount to give them
|
* The amount to give them
|
||||||
* @return True if success (Should be almost always)
|
* @return True if success (Should be almost always)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean deposit(String name, double amount) {
|
public boolean deposit(final String name, final double amount) {
|
||||||
return core.deposit(name, amount);
|
return this.core.deposit(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deposit(final UUID name, final double amount) {
|
||||||
|
return this.core.deposit(name, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Withdraws a given amount of money from the given username and turns it to
|
* Formats the given number... E.g. 50.5 becomes $50.5 Dollars, or 50
|
||||||
* thin air.
|
* Dollars 5 Cents
|
||||||
*
|
*
|
||||||
* @param name
|
* @param balance
|
||||||
* The exact (case insensitive) username to take money from
|
* The given number
|
||||||
* @param amount
|
* @return The balance in human readable text.
|
||||||
* The amount to take from them
|
|
||||||
* @return True if success, false if they didn't have enough cash
|
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public String format(final double balance) {
|
||||||
|
return this.core.format(balance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the balance of the given account name
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The name of the account
|
||||||
|
* @return Their current balance.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean withdraw(String name, double amount) {
|
public double getBalance(final String name) {
|
||||||
return core.withdraw(name, amount);
|
return this.core.getBalance(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getBalance(final UUID name) {
|
||||||
|
return this.core.getBalance(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean has(final String name, final double amount) {
|
||||||
|
return this.core.getBalance(name) >= amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that this economy is valid. Returns false if it is not valid.
|
||||||
|
*
|
||||||
|
* @return True if this economy will work, false if it will not.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return this.core.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.core.getClass().getName().split("_")[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers the given amount of money from Player1 to Player2
|
* Transfers the given amount of money from Player1 to Player2
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from
|
||||||
* The player who is paying money
|
* The player who is paying money
|
||||||
* @param to
|
* @param to
|
||||||
@ -59,61 +97,35 @@ public class Economy implements EconomyCore {
|
|||||||
* @return true if success (Payer had enough cash, receiver was able to
|
* @return true if success (Payer had enough cash, receiver was able to
|
||||||
* receive the funds)
|
* receive the funds)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean transfer(String from, String to, double amount) {
|
public boolean transfer(final String from, final String to, final double amount) {
|
||||||
return core.transfer(from, to, amount);
|
return this.core.transfer(from, to, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transfer(final UUID from, final UUID to, final double amount) {
|
||||||
|
return this.core.transfer(from, to, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the balance of the given account name
|
* Withdraws a given amount of money from the given username and turns it to
|
||||||
*
|
* thin air.
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The name of the account
|
* The exact (case insensitive) username to take money from
|
||||||
* @return Their current balance.
|
* @param amount
|
||||||
|
* The amount to take from them
|
||||||
|
* @return True if success, false if they didn't have enough cash
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public double getBalance(String name) {
|
public boolean withdraw(final String name, final double amount) {
|
||||||
return core.getBalance(name);
|
return this.core.withdraw(name, amount);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats the given number... E.g. 50.5 becomes $50.5 Dollars, or 50
|
|
||||||
* Dollars 5 Cents
|
|
||||||
*
|
|
||||||
* @param balance
|
|
||||||
* The given number
|
|
||||||
* @return The balance in human readable text.
|
|
||||||
*/
|
|
||||||
public String format(double balance) {
|
|
||||||
return core.format(balance);
|
|
||||||
}
|
|
||||||
@Deprecated
|
|
||||||
public boolean has(String name, double amount) {
|
|
||||||
return core.getBalance(name) >= amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public boolean withdraw(final UUID name, final double amount) {
|
||||||
return core.getClass().getName().split("_")[1];
|
return this.core.withdraw(name, amount);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deposit(UUID name, double amount) {
|
|
||||||
return core.deposit(name,amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean withdraw(UUID name, double amount) {
|
|
||||||
return core.withdraw(name, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean transfer(UUID from, UUID to, double amount) {
|
|
||||||
return core.transfer(from, to, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getBalance(UUID name) {
|
|
||||||
return core.getBalance(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,16 +6,11 @@ import java.util.UUID;
|
|||||||
* @author netherfoam Represents an economy.
|
* @author netherfoam Represents an economy.
|
||||||
*/
|
*/
|
||||||
public interface EconomyCore {
|
public interface EconomyCore {
|
||||||
/**
|
public String currencyNamePlural();
|
||||||
* Checks that this economy is valid. Returns false if it is not valid.
|
|
||||||
*
|
|
||||||
* @return True if this economy will work, false if it will not.
|
|
||||||
*/
|
|
||||||
public boolean isValid();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deposits a given amount of money from thin air to the given username.
|
* Deposits a given amount of money from thin air to the given username.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The exact (case insensitive) username to give money to
|
* The exact (case insensitive) username to give money to
|
||||||
* @param amount
|
* @param amount
|
||||||
@ -26,21 +21,55 @@ public interface EconomyCore {
|
|||||||
public boolean deposit(String name, double amount);
|
public boolean deposit(String name, double amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Withdraws a given amount of money from the given username and turns it to
|
* Deposits a given amount of money from thin air to the given username.
|
||||||
* thin air.
|
*
|
||||||
*
|
|
||||||
* @param name
|
* @param name
|
||||||
* The exact (case insensitive) username to take money from
|
* The exact (case insensitive) username to give money to
|
||||||
* @param amount
|
* @param amount
|
||||||
* The amount to take from them
|
* The amount to give them
|
||||||
* @return True if success, false if they didn't have enough cash
|
* @return True if success (Should be almost always)
|
||||||
|
*/
|
||||||
|
public boolean deposit(UUID name, double amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the given number... E.g. 50.5 becomes $50.5 Dollars, or 50
|
||||||
|
* Dollars 5 Cents
|
||||||
|
*
|
||||||
|
* @param balance
|
||||||
|
* The given number
|
||||||
|
* @return The balance in human readable text.
|
||||||
|
*/
|
||||||
|
public String format(double balance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the balance of the given account name
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The name of the account
|
||||||
|
* @return Their current balance.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean withdraw(String name, double amount);
|
public double getBalance(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the balance of the given account name
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The name of the account
|
||||||
|
* @return Their current balance.
|
||||||
|
*/
|
||||||
|
public double getBalance(UUID name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that this economy is valid. Returns false if it is not valid.
|
||||||
|
*
|
||||||
|
* @return True if this economy will work, false if it will not.
|
||||||
|
*/
|
||||||
|
public boolean isValid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers the given amount of money from Player1 to Player2
|
* Transfers the given amount of money from Player1 to Player2
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from
|
||||||
* The player who is paying money
|
* The player who is paying money
|
||||||
* @param to
|
* @param to
|
||||||
@ -53,58 +82,9 @@ public interface EconomyCore {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean transfer(String from, String to, double amount);
|
public boolean transfer(String from, String to, double amount);
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the balance of the given account name
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* The name of the account
|
|
||||||
* @return Their current balance.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public double getBalance(String name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats the given number... E.g. 50.5 becomes $50.5 Dollars, or 50
|
|
||||||
* Dollars 5 Cents
|
|
||||||
*
|
|
||||||
* @param balance
|
|
||||||
* The given number
|
|
||||||
* @return The balance in human readable text.
|
|
||||||
*/
|
|
||||||
public String format(double balance);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deposits a given amount of money from thin air to the given username.
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* The exact (case insensitive) username to give money to
|
|
||||||
* @param amount
|
|
||||||
* The amount to give them
|
|
||||||
* @return True if success (Should be almost always)
|
|
||||||
*/
|
|
||||||
public boolean deposit(UUID name, double amount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Withdraws a given amount of money from the given username and turns it to
|
|
||||||
* thin air.
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* The exact (case insensitive) username to take money from
|
|
||||||
* @param amount
|
|
||||||
* The amount to take from them
|
|
||||||
* @return True if success, false if they didn't have enough cash
|
|
||||||
*/
|
|
||||||
public boolean withdraw(UUID name, double amount);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers the given amount of money from Player1 to Player2
|
* Transfers the given amount of money from Player1 to Player2
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from
|
||||||
* The player who is paying money
|
* The player who is paying money
|
||||||
* @param to
|
* @param to
|
||||||
@ -117,11 +97,27 @@ public interface EconomyCore {
|
|||||||
public boolean transfer(UUID from, UUID to, double amount);
|
public boolean transfer(UUID from, UUID to, double amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the balance of the given account name
|
* Withdraws a given amount of money from the given username and turns it to
|
||||||
*
|
* thin air.
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The name of the account
|
* The exact (case insensitive) username to take money from
|
||||||
* @return Their current balance.
|
* @param amount
|
||||||
|
* The amount to take from them
|
||||||
|
* @return True if success, false if they didn't have enough cash
|
||||||
*/
|
*/
|
||||||
public double getBalance(UUID name);
|
@Deprecated
|
||||||
|
public boolean withdraw(String name, double amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Withdraws a given amount of money from the given username and turns it to
|
||||||
|
* thin air.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The exact (case insensitive) username to take money from
|
||||||
|
* @param amount
|
||||||
|
* The amount to take from them
|
||||||
|
* @return True if success, false if they didn't have enough cash
|
||||||
|
*/
|
||||||
|
public boolean withdraw(UUID name, double amount);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,11 @@ public class Economy_Vault implements EconomyCore {
|
|||||||
setupEconomy();
|
setupEconomy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String currencyNamePlural() {
|
||||||
|
return this.vault.currencyNamePlural();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean deposit(final String name, final double amount) {
|
public boolean deposit(final String name, final double amount) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.maxgamer.QuickShop.Util;
|
package org.maxgamer.QuickShop.Util;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -27,6 +28,7 @@ import cn.citycraft.PluginHelper.utils.LocalUtil;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Util {
|
public class Util {
|
||||||
private static HashSet<Material> blacklist = new HashSet<Material>();
|
private static HashSet<Material> blacklist = new HashSet<Material>();
|
||||||
|
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
|
||||||
private static QuickShop plugin;
|
private static QuickShop plugin;
|
||||||
private static HashSet<Material> shoppables = new HashSet<Material>();
|
private static HashSet<Material> shoppables = new HashSet<Material>();
|
||||||
private static HashSet<Material> tools = new HashSet<Material>();
|
private static HashSet<Material> tools = new HashSet<Material>();
|
||||||
@ -128,9 +130,9 @@ public class Util {
|
|||||||
*/
|
*/
|
||||||
public static String format(final double n) {
|
public static String format(final double n) {
|
||||||
try {
|
try {
|
||||||
return plugin.getEcon().format(n);
|
return DECIMAL_FORMAT.format(n) + plugin.getEcon().currencyNamePlural();
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
return "" + n;
|
return n + "元";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Version: 1.4
|
Version: 1.5
|
||||||
|
|
||||||
not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个商店.'
|
not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个商店.'
|
||||||
no-permission: '&4你没有此命令的权限.'
|
no-permission: '&4你没有此命令的权限.'
|
||||||
@ -19,7 +19,8 @@ shop-purchase-cancelled: '&c取消购买.'
|
|||||||
shop-stock-too-low: '&c商店库存仅剩 {0} {1} '
|
shop-stock-too-low: '&c商店库存仅剩 {0} {1} '
|
||||||
you-cant-afford-to-buy: '&c此商品需要 {0}, 但是你只有 {1}'
|
you-cant-afford-to-buy: '&c此商品需要 {0}, 但是你只有 {1}'
|
||||||
negative-amount: '&c警告, 错误的物品数量.'
|
negative-amount: '&c警告, 错误的物品数量.'
|
||||||
player-bought-from-your-store: '&d{0} 购买了 {1} {2} 从你的商店.'
|
player-bought-from-your-store: '&d{0} 从你的商店买走了 {1} 个 {2}.'
|
||||||
|
player-bought-from-your-store-tax: '&d{0} 从你的商店买走了 {1} 个 {2} &c你上缴了 {3} 的税金.'
|
||||||
shop-out-of-stock: '&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了'
|
shop-out-of-stock: '&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了'
|
||||||
shop-has-no-space: '&c商店只能收购 {0} 个 {1} 商品.'
|
shop-has-no-space: '&c商店只能收购 {0} 个 {1} 商品.'
|
||||||
you-dont-have-that-many-items: '&c你只有 {0} {1}.'
|
you-dont-have-that-many-items: '&c你只有 {0} {1}.'
|
||||||
@ -53,7 +54,9 @@ menu:
|
|||||||
damage-percent-remaining: '&a耐久剩余: &e{0}.'
|
damage-percent-remaining: '&a耐久剩余: &e{0}.'
|
||||||
this-shop-is-buying: '&a此商店只 &d收购&a 物品.'
|
this-shop-is-buying: '&a此商店只 &d收购&a 物品.'
|
||||||
this-shop-is-selling: '&a此商店只 &b出售&a 商品.'
|
this-shop-is-selling: '&a此商店只 &b出售&a 商品.'
|
||||||
|
sell-tax: '&a你上缴了 &e{0} &a的税金.'
|
||||||
|
sell-tax-self: '&a你拥有这家商店,所以你不用交税.'
|
||||||
|
|
||||||
info:
|
info:
|
||||||
title: '&a当前加载的 &e{0} &a个区块中 共有 &e{1} &a个商店 覆盖 &e{2} &a个世界.'
|
title: '&a当前加载的 &e{0} &a个区块中 共有 &e{1} &a个商店 覆盖 &e{2} &a个世界.'
|
||||||
selling: '&b出售商店&a有 &e{0} &a个.'
|
selling: '&b出售商店&a有 &e{0} &a个.'
|
||||||
|
Loading…
Reference in New Issue
Block a user