Add a way to display ShopTransaction.java
This commit is contained in:
@@ -17,6 +17,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -50,6 +51,8 @@ public class PlayerShop {
|
||||
private boolean notifiedOwner = false;
|
||||
@Getter @Setter
|
||||
private boolean dirty;
|
||||
@Getter
|
||||
private List<ShopTransaction> transactions = new ArrayList<>();
|
||||
|
||||
public PlayerShop(Location shopLocation, Location signLocation, Player player) {
|
||||
this(shopLocation, signLocation, player.getUniqueId(), player.getName());
|
||||
@@ -270,6 +273,7 @@ public class PlayerShop {
|
||||
InventoryUtils.addItem(player.getInventory(), itemStack);
|
||||
player.updateInventory();
|
||||
|
||||
addTransaction(new ShopTransaction(ShopAction.SELL, player.getName(), orders, price));
|
||||
return TransactionError.NONE;
|
||||
}
|
||||
|
||||
@@ -310,6 +314,7 @@ public class PlayerShop {
|
||||
InventoryUtils.addItem(getInventory(), itemStack);
|
||||
player.updateInventory();
|
||||
|
||||
addTransaction(new ShopTransaction(ShopAction.BUY, player.getName(), orders, price));
|
||||
return TransactionError.NONE;
|
||||
}
|
||||
|
||||
@@ -379,6 +384,10 @@ public class PlayerShop {
|
||||
updateSign();
|
||||
}
|
||||
|
||||
private void addTransaction(ShopTransaction transaction) {
|
||||
transactions.add(transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Shop: " + this.getShopID()
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
public record ShopTransaction(ShopAction shopAction, String Name, int transactions, double value) {}
|
||||
Reference in New Issue
Block a user