2012-06-08 15:28:36 +02:00
|
|
|
package com.Acrobot.ChestShop.Events;
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
import org.bukkit.OfflinePlayer;
|
2012-06-08 15:28:36 +02:00
|
|
|
import org.bukkit.block.Sign;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.event.HandlerList;
|
2012-08-10 18:56:16 +02:00
|
|
|
import org.bukkit.inventory.Inventory;
|
2012-06-08 15:28:36 +02:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class TransactionEvent extends Event {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
2012-08-10 18:56:16 +02:00
|
|
|
private final TransactionType type;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
private final Inventory ownerInventory;
|
|
|
|
private final Inventory clientInventory;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
private final Player client;
|
|
|
|
private final OfflinePlayer owner;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
private final ItemStack[] stock;
|
|
|
|
private final double price;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
private final Sign sign;
|
|
|
|
|
|
|
|
public TransactionEvent(PreTransactionEvent event, Sign sign) {
|
|
|
|
this.type = event.getTransactionType();
|
|
|
|
|
|
|
|
this.ownerInventory = event.getOwnerInventory();
|
|
|
|
this.clientInventory = event.getClientInventory();
|
|
|
|
|
|
|
|
this.client = event.getClient();
|
|
|
|
this.owner = event.getOwner();
|
|
|
|
|
|
|
|
this.stock = event.getStock();
|
|
|
|
this.price = event.getPrice();
|
2012-06-08 15:28:36 +02:00
|
|
|
|
|
|
|
this.sign = sign;
|
2012-08-10 18:56:16 +02:00
|
|
|
}
|
|
|
|
|
2012-11-29 20:28:16 +01:00
|
|
|
public TransactionEvent(TransactionType type, Inventory ownerInventory, Inventory clientInventory, Player client, OfflinePlayer owner, ItemStack[] stock, double price, Sign sign) {
|
2012-08-10 18:56:16 +02:00
|
|
|
this.type = type;
|
|
|
|
|
|
|
|
this.ownerInventory = ownerInventory;
|
|
|
|
this.clientInventory = clientInventory;
|
2012-06-08 15:28:36 +02:00
|
|
|
|
|
|
|
this.client = client;
|
|
|
|
this.owner = owner;
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
this.stock = stock;
|
2012-06-08 15:28:36 +02:00
|
|
|
this.price = price;
|
2012-08-10 18:56:16 +02:00
|
|
|
|
|
|
|
this.sign = sign;
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public TransactionType getTransactionType() {
|
|
|
|
return type;
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public Inventory getOwnerInventory() {
|
|
|
|
return ownerInventory;
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public Inventory getClientInventory() {
|
|
|
|
return clientInventory;
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Player getClient() {
|
|
|
|
return client;
|
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public OfflinePlayer getOwner() {
|
2012-06-08 15:28:36 +02:00
|
|
|
return owner;
|
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public ItemStack[] getStock() {
|
|
|
|
return stock;
|
2012-06-08 15:28:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public double getPrice() {
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public Sign getSign() {
|
|
|
|
return sign;
|
|
|
|
}
|
|
|
|
|
2012-06-08 15:28:36 +02:00
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
2012-08-10 18:56:16 +02:00
|
|
|
public enum TransactionType {
|
2012-06-08 15:28:36 +02:00
|
|
|
BUY,
|
|
|
|
SELL
|
|
|
|
}
|
|
|
|
}
|