Skip to content

Commit

Permalink
supporting Arclight Server
Browse files Browse the repository at this point in the history
  • Loading branch information
Tining123 committed Aug 27, 2022
1 parent 8cd7b21 commit 5b0be0e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.Tining</groupId>
<artifactId>DemonMarket</artifactId>
<version>1.3.9</version>
<version>1.4.0</version>
<build>
<plugins>
<plugin>
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/tining/demonmarket/command/UserCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
// 给收款人发消息
try{
Player onlineReceiver = Bukkit.getPlayer(args[1]);
onlineReceiver.sendMessage(ChatColor.YELLOW + String.format(LangUtil.get("收款成功,从%s收到%s"), player.getName(), totalPrice));
onlineReceiver.sendMessage(ChatColor.YELLOW +
String.format(LangUtil.get("收款成功,从%s收到%s"), player.getName(), MarketEconomy.formatMoney(totalPrice)));
}catch (Exception ignore){}

player.sendMessage(ChatColor.YELLOW + String.format(LangUtil.get("转账成功,花费%S,转账%s"), totalValue, totalPrice));
player.sendMessage(ChatColor.YELLOW + String.format(LangUtil.get("转账成功,花费%S,转账%s"),
totalValue, MarketEconomy.formatMoney(totalPrice)));
return true;

}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/tining/demonmarket/economy/MarketEconomy.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public class MarketEconomy {
* @param money
* @return
*/
public static double formatMoney(double money) {
public static String formatMoney(double money) {
if (ConfigReader.getRoundSetting().toLowerCase(Locale.ROOT).equals("true")) {
return Double.parseDouble(String.format("%.2f", money));
return String.format("%.2f", money);
}
return money;
return money + "";
}

/**
Expand All @@ -44,7 +44,7 @@ public static double getSellingPrice(double value, int count, double money) {
price += onePrice;
money += onePrice;
}
return formatMoney(price);
return price;
}

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ public static boolean isIllegalItem(ItemStack itemStack) {
}

public static double getTax(double price) {
return formatMoney(price * ConfigReader.getTaxRate());
return price * ConfigReader.getTaxRate();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private static ItemMeta getNBTPriceLore(ItemStack is, Player player) {
lore = new ArrayList<>();
}
lore.add(ChatColor.YELLOW + LangUtil.get("原价:") + price);
lore.add(ChatColor.YELLOW + LangUtil.get("现价:") + String.format("%.2f", value));
lore.add(ChatColor.YELLOW + LangUtil.get("现价:") + MarketEconomy.formatMoney(value));

ItemMeta itemMeta = is.getItemMeta();
itemMeta.setLore(lore);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/tining/demonmarket/gui/ChestGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ private static void drawPage(Inventory inventory, Player player) {
}
//更新paper
double count = ChestGui.preCheckOut(inventory,player);
count = MarketEconomy.formatMoney(count);
String countStr = MarketEconomy.formatMoney(count);
ItemMeta itemMeta = priceToken.getItemMeta();
itemMeta.setDisplayName(LangUtil.get("合计:"));
itemMeta.setLore(Collections.singletonList(ChatColor.YELLOW + LangUtil.get("总价:$") + count));
itemMeta.setLore(Collections.singletonList(ChatColor.YELLOW + LangUtil.get("总价:$") + countStr));
priceToken.setItemMeta(itemMeta);

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: DemonMarket
main: com.tining.demonmarket.Main
version: 1.3.9
version: 1.4.0
api-version: 1.13
# YAML 中的注释,一行有效
# 以上是插件基本信息,以下是命令注册
Expand Down

0 comments on commit 5b0be0e

Please sign in to comment.