mirror of
https://github.com/songoda/EpicVouchers.git
synced 2024-11-14 22:25:29 +01:00
Made the classes (ForceRedeem, VoucherReceive, VoucherRedeem) follow the contract provided by Event properly
This commit is contained in:
parent
f27a76a583
commit
c1b57454b9
@ -8,48 +8,52 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
public class ForceRedeemEvent extends Event implements Cancellable {
|
public class ForceRedeemEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final String voucher;
|
private final String voucher;
|
||||||
private final int amount;
|
private final int amount;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public ForceRedeemEvent(Player player, String voucher, int amount, CommandSender sender) {
|
public ForceRedeemEvent(Player player, String voucher, int amount, CommandSender sender) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.voucher = voucher;
|
this.voucher = voucher;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVoucher() {
|
public String getVoucher() {
|
||||||
return voucher;
|
return voucher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount() {
|
public int getAmount() {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandSender getSender() {
|
public CommandSender getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled) {
|
public void setCancelled(boolean cancelled) {
|
||||||
this.cancelled = cancelled;
|
this.cancelled = cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,54 +9,58 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class VoucherReceiveEvent extends Event implements Cancellable {
|
public class VoucherReceiveEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final String voucher;
|
private final String voucher;
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
private final int amount;
|
private final int amount;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public VoucherReceiveEvent(Player player, String voucher, ItemStack item, int amount, CommandSender sender) {
|
public VoucherReceiveEvent(Player player, String voucher, ItemStack item, int amount, CommandSender sender) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.voucher = voucher;
|
this.voucher = voucher;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVoucher() {
|
public String getVoucher() {
|
||||||
return voucher;
|
return voucher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount() {
|
public int getAmount() {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandSender getSender() {
|
public CommandSender getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled) {
|
public void setCancelled(boolean cancelled) {
|
||||||
this.cancelled = cancelled;
|
this.cancelled = cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,48 +8,52 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class VoucherRedeemEvent extends Event implements Cancellable {
|
public class VoucherRedeemEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final String voucher;
|
private final String voucher;
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
private final boolean manual;
|
private final boolean manual;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public VoucherRedeemEvent(Player player, String voucher, ItemStack item, boolean manual) {
|
public VoucherRedeemEvent(Player player, String voucher, ItemStack item, boolean manual) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.voucher = voucher;
|
this.voucher = voucher;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.manual = manual;
|
this.manual = manual;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVoucher() {
|
public String getVoucher() {
|
||||||
return voucher;
|
return voucher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getManual() {
|
public boolean getManual() {
|
||||||
return manual;
|
return manual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled) {
|
public void setCancelled(boolean cancelled) {
|
||||||
this.cancelled = cancelled;
|
this.cancelled = cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -141,7 +141,6 @@ public class Voucher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void give(CommandSender sender, List<Player> players, int amount) {
|
public void give(CommandSender sender, List<Player> players, int amount) {
|
||||||
|
|
||||||
String giveMessage = instance.getLocale().getMessage("command.give.send")
|
String giveMessage = instance.getLocale().getMessage("command.give.send")
|
||||||
.processPlaceholder("player", players.size() == 1 ? players.get(0).getName() : "everyone")
|
.processPlaceholder("player", players.size() == 1 ? players.get(0).getName() : "everyone")
|
||||||
.processPlaceholder("voucher", Matcher.quoteReplacement(getName(true)))
|
.processPlaceholder("voucher", Matcher.quoteReplacement(getName(true)))
|
||||||
|
Loading…
Reference in New Issue
Block a user