Skip to content

Instantly share code, notes, and snippets.

@brcdev
Created August 18, 2017 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brcdev/cd22ffdd4ce5a1974f7c1e4cd7228740 to your computer and use it in GitHub Desktop.
Save brcdev/cd22ffdd4ce5a1974f7c1e4cd7228740 to your computer and use it in GitHub Desktop.
package net.brcdev.shopgui.api.event;
import net.brcdev.shopgui.shop.ShopItem;
import net.brcdev.shopgui.shop.ShopManager.ShopAction;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ShopPreTransactionEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private ShopAction shopAction;
private ShopItem shopItem;
private Player player;
private int amount;
private double price;
public ShopPreTransactionEvent(ShopAction shopAction, ShopItem shopItem, Player player, int amount, double price) {
this.shopAction = shopAction;
this.shopItem = shopItem;
this.player = player;
this.amount = amount;
this.price = price;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public ShopItem getShopItem() {
return shopItem;
}
public ShopAction getShopAction() {
return shopAction;
}
public Player getPlayer() {
return player;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
@LukeBen
Copy link

LukeBen commented Apr 22, 2020

Is there a way to get the current item??

@brcdev
Copy link
Author

brcdev commented Apr 22, 2020

Is there a way to get the current item??

Use the getShopItem() method for this. Please consider using the version from official API repo in future, this gist is deprecated and won't be updated anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment