mirror of
https://github.com/Artillex-Studios/AxTrade.git
synced 2025-01-19 21:11:19 +01:00
1.8.1
This commit is contained in:
parent
3d945b12c7
commit
2f4dbc331d
10
pom.xml
10
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.artillexstudios</groupId>
|
||||
<artifactId>AxTrade</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>AxTrade</name>
|
||||
@ -106,13 +106,17 @@
|
||||
<id>rosewood-repo</id>
|
||||
<url>https://repo.rosewooddev.io/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>alessiodp</id>
|
||||
<url>https://repo.alessiodp.com/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.artillexstudios.axapi</groupId>
|
||||
<artifactId>axapi</artifactId>
|
||||
<version>1.4.332</version>
|
||||
<version>1.4.385</version>
|
||||
<scope>compile</scope>
|
||||
<classifier>all</classifier>
|
||||
</dependency>
|
||||
@ -252,7 +256,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.Emibergo02</groupId>
|
||||
<artifactId>RedisEconomy</artifactId>
|
||||
<version>main-3338e61c6c-1</version>
|
||||
<version>4.3.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -64,7 +64,7 @@ public class Commands implements OrphanCommand {
|
||||
@Subcommand("accept")
|
||||
public void accept(@NotNull Player sender, @NotNull Player other) {
|
||||
var request = Requests.getRequest(sender, other);
|
||||
if (request == null || request.getSender().equals(sender)) {
|
||||
if (request == null || request.getSender().equals(sender) || !request.isActive()) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.no-request", Map.of("%player%", other.getName()));
|
||||
return;
|
||||
}
|
||||
@ -75,12 +75,12 @@ public class Commands implements OrphanCommand {
|
||||
@Subcommand("deny")
|
||||
public void deny(@NotNull Player sender, @NotNull Player other) {
|
||||
var request = Requests.getRequest(sender, other);
|
||||
if (request == null || request.getSender().equals(sender) || request.isDeclined()) {
|
||||
if (request == null || request.getSender().equals(sender) || !request.isActive()) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.no-request", Map.of("%player%", other.getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
request.decline();
|
||||
request.deactivate();
|
||||
MESSAGEUTILS.sendLang(request.getSender(), "request.deny-sender", Map.of("%player%", request.getReceiver().getName()));
|
||||
MESSAGEUTILS.sendLang(request.getReceiver(), "request.deny-receiver", Map.of("%player%", request.getSender().getName()));
|
||||
SoundUtils.playSound(request.getSender(), "deny");
|
||||
|
@ -46,6 +46,7 @@ public class TradeListeners implements Listener {
|
||||
}
|
||||
if (request.getReceiver().equals(event.getPlayer())) {
|
||||
iterator.remove();
|
||||
if (!request.isActive()) continue;
|
||||
MESSAGEUTILS.sendLang(request.getSender(), "request.expired", Map.of("%player%", request.getReceiver().getName()));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class Request {
|
||||
private final long time;
|
||||
private final Player sender;
|
||||
private final Player receiver;
|
||||
private boolean declined = false;
|
||||
private boolean active = true;
|
||||
|
||||
public Request(Player sender, Player receiver) {
|
||||
this.time = System.currentTimeMillis();
|
||||
@ -26,11 +26,11 @@ public class Request {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public boolean isDeclined() {
|
||||
return declined;
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
public void decline() {
|
||||
declined = true;
|
||||
public void deactivate() {
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,10 @@ public class Requests {
|
||||
if (!request.getSender().equals(sender)) {
|
||||
Trades.addTrade(sender, receiver);
|
||||
requests.remove(request);
|
||||
request.deactivate();
|
||||
return;
|
||||
}
|
||||
if (request.isDeclined() || System.currentTimeMillis() - request.getTime() < CONFIG.getInt("trade-request-expire-seconds", 60) * 1_000L) {
|
||||
if (!request.isActive() || System.currentTimeMillis() - request.getTime() < CONFIG.getInt("trade-request-expire-seconds", 60) * 1_000L) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.already-sent", replacements);
|
||||
return;
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public class GuiFrame {
|
||||
final Pair<String, String> otherTextures = NMSHandlers.getNmsHandler().textures(trade.getOtherPlayer(player.getPlayer()));
|
||||
|
||||
final HashMap<String, String> map = new HashMap<>(Map.of(
|
||||
"%own-head%", selfTextures == null ? "" : selfTextures.getFirst(),
|
||||
"%partner-head%", otherTextures == null ? "" : otherTextures.getFirst()
|
||||
"%own-head%", selfTextures == null ? "" : selfTextures.getKey(),
|
||||
"%partner-head%", otherTextures == null ? "" : otherTextures.getKey()
|
||||
));
|
||||
|
||||
map.putAll(replacements);
|
||||
|
@ -57,7 +57,7 @@ request:
|
||||
deny-receiver: "&#CCFFEEYou have successfully denied �FFDD%player%&#CCFFEE's trade request!"
|
||||
cant-trade-self: "&#CCFFEEYou can't send a trade request to yourself!"
|
||||
already-in-trade: "&#CCFFEEThe player is already trading with someone!"
|
||||
already-sent: "&#CCFFEEYou have already sent a trade request to �FFDD%player%&#CCFFEE!"
|
||||
already-sent: "&#CCFFEEYou have already sent a trade request to �FFDD%player% &#CCFFEErecently!"
|
||||
too-far: "&#CCFFEEYou are too far from �FFDD%player% &#CCFFEEto send a trade request!"
|
||||
not-accepting: "&#CCFFEEThis player is not accepting trades right now!"
|
||||
disallowed-gamemode: "&#CCFFEEEither you or the other player is in a disallowed gamemode!"
|
||||
|
Loading…
Reference in New Issue
Block a user