ChestShop-3/com/Acrobot/ChestShop/Events/TransactionEvent.java

104 lines
2.3 KiB
Java
Raw Normal View History

package com.Acrobot.ChestShop.Events;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/**
* @author Acrobot
*/
public class TransactionEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private final TransactionType type;
private final Inventory ownerInventory;
private final Inventory clientInventory;
private final Player client;
private final OfflinePlayer owner;
private final ItemStack[] stock;
private final double price;
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();
this.sign = sign;
}
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) {
this.type = type;
this.ownerInventory = ownerInventory;
this.clientInventory = clientInventory;
this.client = client;
this.owner = owner;
this.stock = stock;
this.price = price;
this.sign = sign;
}
public TransactionType getTransactionType() {
return type;
}
public Inventory getOwnerInventory() {
return ownerInventory;
}
public Inventory getClientInventory() {
return clientInventory;
}
public Player getClient() {
return client;
}
public OfflinePlayer getOwner() {
return owner;
}
public ItemStack[] getStock() {
return stock;
}
public double getPrice() {
return price;
}
public Sign getSign() {
return sign;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public enum TransactionType {
BUY,
SELL
}
}