Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Add PlayerItemDamageEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 authored and SpigotMC committed Sep 4, 2014
1 parent 27a57c8 commit 6719fbf
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 6719fbf

Please sign in to comment.