This repository has been archived by the owner on Dec 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |