Skip to content

Commit

Permalink
feat: Remove MarketData#getLastMoney
Browse files Browse the repository at this point in the history
  • Loading branch information
blank038 committed Dec 2, 2023
1 parent 00934a5 commit f68e917
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,6 @@ public PayType getPayType() {
return this.paytype;
}

/**
* 获取扣税后的价格
* <p>
* TODO: 此方法将在未来版本移除, 将改用为 MarketData#getPermsValueForPlayer 方法
*
* @param player 目标玩家
* @param money 初始金币
* @return 扣税后金币
*/
@Deprecated
public double getLastMoney(ConfigurationSection section, Player player, double money) {
String header = section.getString("header");
double tax = section.getDouble("node.default");
for (String key : section.getConfigurationSection("node").getKeys(false)) {
double tempTax = section.getDouble("node." + key);
if (player.hasPermission(header + "." + key) && tempTax < tax) {
tax = tempTax;
}
}
return money - money * tax;
}

/**
* 获取玩家在权限节点上的值
*
Expand Down Expand Up @@ -211,7 +189,7 @@ public void tryBuySale(Player buyer, String uuid, boolean shift, int page, Filte
BaseEconomy.getEconomyBridge(this.paytype).take(buyer, this.ecoType, saleItem.getPrice());
Player seller = Bukkit.getPlayer(UUID.fromString(saleItem.getOwnerUUID()));
if (seller != null && seller.isOnline()) {
double last = this.getLastMoney(this.getTaxSection(), seller, saleItem.getPrice());
double last = saleItem.getPrice() - saleItem.getPrice() * this.getPermsValueForPlayer(this.getTaxSection(), seller);
DecimalFormat df = new DecimalFormat("#0.00");
BaseEconomy.getEconomyBridge(this.paytype).give(seller, this.ecoType, last);
seller.sendMessage(I18n.getStrAndHeader("sale-sell")
Expand Down

0 comments on commit f68e917

Please sign in to comment.