From 167c725c39eea50e343b733f65474b229b62da87 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 4 Dec 2016 01:02:45 -0500 Subject: [PATCH] EMC AnvilEvent --- .../customevents/AnvilEvent.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/main/java/com/empireminecraft/customevents/AnvilEvent.java diff --git a/src/main/java/com/empireminecraft/customevents/AnvilEvent.java b/src/main/java/com/empireminecraft/customevents/AnvilEvent.java new file mode 100644 index 000000000..efa108cd3 --- /dev/null +++ b/src/main/java/com/empireminecraft/customevents/AnvilEvent.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.empireminecraft.customevents; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +public class AnvilEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean canceled; + final Player player; + final ItemStack left; + final ItemStack right; + ItemStack result; + int cost; + public AnvilEvent(Player player, ItemStack left, ItemStack right, ItemStack result, int cost) { + this.player = player; + this.left = left; + this.right = right; + this.result = result; + this.cost = cost; + } + + public Player getPlayer() { + return player; + } + + public ItemStack getLeft() { + return left; + } + + public ItemStack getRight() { + return right; + } + + public ItemStack getResult() { + return result; + } + + public int getCost() { + return cost; + } + + public void setCost(int cost) { + this.cost = cost; + } + + public void setResult(ItemStack result) { + this.result = result; + } + + public boolean isCancelled() { + return canceled; + } + + public void setCancelled(boolean cancel) { + canceled = cancel; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} -- 2.25.1.windows.1