From f66d9edad3a1f502fd1ad155e32ae9f27febad6e Mon Sep 17 00:00:00 2001
From: BenceX100 <52270269+BenceX100@users.noreply.github.com>
Date: Tue, 21 May 2024 12:52:53 +0200
Subject: [PATCH] 1.1.1
---
pom.xml | 2 +-
.../axtrade/hooks/currency/PlaceholderCurrencyHook.java | 8 ++++++--
.../axtrade/listeners/PlayerInteractEntityListener.java | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 731354f..bde34a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.artillexstudios
AxTrade
- 1.1.0
+ 1.1.1
jar
AxTrade
diff --git a/src/main/java/com/artillexstudios/axtrade/hooks/currency/PlaceholderCurrencyHook.java b/src/main/java/com/artillexstudios/axtrade/hooks/currency/PlaceholderCurrencyHook.java
index 71adbc1..5d70156 100644
--- a/src/main/java/com/artillexstudios/axtrade/hooks/currency/PlaceholderCurrencyHook.java
+++ b/src/main/java/com/artillexstudios/axtrade/hooks/currency/PlaceholderCurrencyHook.java
@@ -53,7 +53,7 @@ public class PlaceholderCurrencyHook implements CurrencyHook {
final OfflinePlayer pl = Bukkit.getOfflinePlayer(player);
if (pl.getName() == null) return;
final String placeholder = section.getString("settings.give-command")
- .replace("%amount%", "" + amount)
+ .replace("%amount%", parseNumber(amount))
.replace("%player%", pl.getName());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), placeholder);
}
@@ -63,8 +63,12 @@ public class PlaceholderCurrencyHook implements CurrencyHook {
final OfflinePlayer pl = Bukkit.getOfflinePlayer(player);
if (pl.getName() == null) return;
final String placeholder = section.getString("settings.take-command")
- .replace("%amount%", "" + amount)
+ .replace("%amount%", parseNumber(amount))
.replace("%player%", pl.getName());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), placeholder);
}
+
+ private String parseNumber(double amount) {
+ return usesDouble() ? "" + amount : "" + Math.round(amount);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/artillexstudios/axtrade/listeners/PlayerInteractEntityListener.java b/src/main/java/com/artillexstudios/axtrade/listeners/PlayerInteractEntityListener.java
index f305dd8..71ef90b 100644
--- a/src/main/java/com/artillexstudios/axtrade/listeners/PlayerInteractEntityListener.java
+++ b/src/main/java/com/artillexstudios/axtrade/listeners/PlayerInteractEntityListener.java
@@ -18,6 +18,7 @@ public class PlayerInteractEntityListener implements Listener {
public void onClick(@NotNull PlayerInteractEntityEvent event) {
if (!CONFIG.getBoolean("shift-click-send-request", true)) return;
final Player player = event.getPlayer();
+ if (!player.hasPermission("axtrade.trade")) return;
if (cd.containsKey(player) && System.currentTimeMillis() - cd.get(player) < 100L) return;