Skip to content

Commit

Permalink
Bump version 1.1.4.
Browse files Browse the repository at this point in the history
Add tax bypass permission.
Close #18.
  • Loading branch information
IzzelAliz committed Sep 1, 2019
1 parent 3186ea6 commit 5970ac4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def ci = System.getenv().containsKey('CI')
if (!ci) apply plugin: 'signing'

group = 'io.izzel.ambershop'
version = '1.1.3' + (ci ? "-ci-${System.getenv('APPVEYOR_REPO_COMMIT').substring(0, 8)}" : '')
version = '1.1.4' + (ci ? "-ci-${System.getenv('APPVEYOR_REPO_COMMIT').substring(0, 8)}" : '')

minecraft {
version = '1.12.2-14.23.5.2768'
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/izzel/ambershop/trade/PlayerShopTrading.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PlayerShopTrading implements Trading {

private final ItemStack type;

private final boolean showTax;
private final boolean showTax, hasTax;

@Override
public OperationResult performTransaction() {
Expand All @@ -42,7 +42,7 @@ public OperationResult performTransaction() {
var sr = Util.performEconomy(fromAccount, price, false);
if (sr.isFail()) return sr;
val settings = AmberShop.SINGLETON.getConfig().get().shopSettings.taxSettings;
val taxed = settings.enable ? price.multiply(BigDecimal.valueOf(1D - settings.tax)).setScale(2, RoundingMode.HALF_UP) : price;
val taxed = hasTax && settings.enable ? price.multiply(BigDecimal.valueOf(1D - settings.tax)).setScale(2, RoundingMode.HALF_UP) : price;
var cr = Util.performEconomy(toAccount, taxed, true);
if (cr.isFail()) {
Util.performEconomy(fromAccount, price, true);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/izzel/ambershop/trade/Trades.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ public Trading playerShopTrade(Player player, ShopRecord record, int amount, boo
val chestInv = ((TileEntityCarrier) location.getTileEntity().get()).getInventory();
val playerInv = Inventories.getMainInventory(player);
val playerUid = player.getUniqueId();
val tax = !player.hasPermission("ambershop.admin.no-tax");
if (record.isUnlimited()) {
return new UnlimitedShopTrading(playerInv, playerUid, amount, Math.abs(record.price), record.getItemType().createStack(), sell);
} else {
if (sell) {
return new PlayerShopTrading(playerInv, chestInv, playerUid, record.owner, amount,
Math.abs(record.price), record.getItemType().createStack(), false);
Math.abs(record.price), record.getItemType().createStack(), false, tax);
} else {
return new PlayerShopTrading(chestInv, playerInv, record.owner, playerUid, amount,
Math.abs(record.price), record.getItemType().createStack(), true);
Math.abs(record.price), record.getItemType().createStack(), true, tax);
}
}
}
Expand Down

0 comments on commit 5970ac4

Please sign in to comment.