2014-11-28 02:17:45 +01:00
|
|
|
From 0a83eb0476ad914249b85f2b55e76c6bdc41e253 Mon Sep 17 00:00:00 2001
|
2014-07-21 22:46:54 +02:00
|
|
|
From: md_5 <md_5@live.com.au>
|
|
|
|
Date: Mon, 4 Mar 2013 18:31:20 +1100
|
|
|
|
Subject: [PATCH] Add PlayerItemDamageEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..38a72ab
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
|
|
|
|
@@ -0,0 +1,54 @@
|
|
|
|
+package org.bukkit.event.player;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
+import org.bukkit.event.Cancellable;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
|
|
|
+import org.bukkit.inventory.ItemStack;
|
|
|
|
+
|
|
|
|
+public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable {
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+ private final ItemStack item;
|
|
|
|
+ private int damage;
|
|
|
|
+ private boolean cancelled = false;
|
|
|
|
+
|
|
|
|
+ public PlayerItemDamageEvent(Player player, ItemStack what, int damage) {
|
|
|
|
+ super(player);
|
|
|
|
+ this.item = what;
|
|
|
|
+ this.damage = damage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ItemStack getItem() {
|
|
|
|
+ return item;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the amount of durability damage this item will be taking.
|
|
|
|
+ *
|
|
|
|
+ * @return durability change
|
|
|
|
+ */
|
|
|
|
+ public int getDamage() {
|
|
|
|
+ return damage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setDamage(int damage) {
|
|
|
|
+ this.damage = damage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancelled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ this.cancelled = cancel;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2014-11-28 02:17:45 +01:00
|
|
|
2.1.0
|
2014-07-21 22:46:54 +02:00
|
|
|
|