mirror of
https://github.com/Artillex-Studios/AxTrade.git
synced 2025-01-04 18:47:51 +01:00
1.3.0
This commit is contained in:
parent
727806f690
commit
298bfb1c38
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.artillexstudios</groupId>
|
||||
<artifactId>AxTrade</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.3.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>AxTrade</name>
|
||||
|
@ -16,6 +16,7 @@ import dev.triumphteam.gui.guis.StorageGui;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -120,9 +121,15 @@ public class TradeGui extends GuiFrame {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.isShiftClick() && !slots.contains(event.getView().getTopInventory().firstEmpty())) {
|
||||
if (event.getCurrentItem() != null && event.isShiftClick() && event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && !slots.contains(event.getView().getTopInventory().firstEmpty())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
for (int i : slots) {
|
||||
if (gui.getInventory().getItem(i) == null) {
|
||||
gui.getInventory().setItem(i, event.getCurrentItem().clone());
|
||||
event.getCurrentItem().setAmount(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.cancel();
|
||||
@ -230,8 +237,6 @@ public class TradeGui extends GuiFrame {
|
||||
gui.updateItem(slot, new GuiItem(otherItems.get(n), event -> event.setCancelled(true)));
|
||||
n++;
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
public List<ItemStack> getItems() {
|
||||
|
@ -7,6 +7,7 @@ import com.artillexstudios.axtrade.utils.SoundUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.artillexstudios.axtrade.AxTrade.CONFIG;
|
||||
|
||||
@ -57,19 +58,30 @@ public class TradePlayer {
|
||||
trade.update();
|
||||
SoundUtils.playSound(player, "accept");
|
||||
SoundUtils.playSound(otherPlayer.getPlayer(), "accept");
|
||||
|
||||
getTradeGui().updateTitle();
|
||||
otherPlayer.getTradeGui().updateTitle();
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
if (confirmed != null) {
|
||||
this.confirmed = null;
|
||||
otherPlayer.setConfirmed(null);
|
||||
SoundUtils.playSound(player, "cancel");
|
||||
SoundUtils.playSound(otherPlayer.getPlayer(), "cancel");
|
||||
|
||||
getTradeGui().updateTitle();
|
||||
otherPlayer.getTradeGui().updateTitle();
|
||||
return;
|
||||
}
|
||||
otherPlayer.setConfirmed(null);
|
||||
if (otherPlayer.setConfirmed(null)) getTradeGui().updateTitle();
|
||||
}
|
||||
|
||||
public void setConfirmed(Integer confirmed) {
|
||||
public boolean setConfirmed(Integer confirmed) {
|
||||
if (Objects.equals(this.confirmed, confirmed)) return false;
|
||||
this.confirmed = confirmed;
|
||||
getTradeGui().updateTitle();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
|
Loading…
Reference in New Issue
Block a user