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

98 lines
2.0 KiB
Java
Raw Normal View History

2013-01-15 21:33:00 +01:00
package com.Acrobot.ChestShop.Events;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* @author Acrobot
*/
public class PreShopCreationEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Player creator;
private CreationOutcome outcome = CreationOutcome.SHOP_CREATED_SUCCESSFULLY;
private Sign sign;
private String[] signLines;
public PreShopCreationEvent(Player creator, Sign sign, String[] signLines) {
this.creator = creator;
this.sign = sign;
this.signLines = signLines.clone();
}
public boolean isCancelled() {
return outcome != CreationOutcome.SHOP_CREATED_SUCCESSFULLY;
}
2013-01-24 22:35:28 +01:00
public CreationOutcome getOutcome() {
return outcome;
}
2013-01-15 21:33:00 +01:00
public void setOutcome(CreationOutcome outcome) {
this.outcome = outcome;
}
public void setCreator(Player creator) {
this.creator = creator;
}
public void setSign(Sign sign) {
this.sign = sign;
}
public void setSignLines(String[] signLines) {
this.signLines = signLines;
}
public void setSignLine(byte line, String text) {
this.signLines[line] = text;
}
public Player getPlayer() {
return creator;
}
public Sign getSign() {
return sign;
}
public String getSignLine(byte line) {
return signLines[line];
}
public String[] getSignLines() {
return signLines;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public static enum CreationOutcome {
INVALID_ITEM,
INVALID_PRICE,
INVALID_QUANTITY,
SELL_PRICE_HIGHER_THAN_BUY_PRICE,
NO_CHEST,
NO_PERMISSION,
NO_PERMISSION_FOR_TERRAIN,
NO_PERMISSION_FOR_CHEST,
NOT_ENOUGH_MONEY,
OTHER, //For plugin use!
SHOP_CREATED_SUCCESSFULLY
}
}