forked from Bukkit/Bukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PlayerInteractEntityEvent which fires when a player right click…
…s an entity. Thanks fullwall!
- Loading branch information
EvilSeph
committed
May 2, 2011
1 parent
5c4f940
commit 4e3d770
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
src/main/java/org/bukkit/event/player/PlayerInteractEntityEvent.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,47 @@ | ||
package org.bukkit.event.player; | ||
|
||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
|
||
/** | ||
* Represents an event that is called when a player right clicks an entity. | ||
*/ | ||
public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellable { | ||
protected Entity clickedEntity; | ||
boolean cancelled = false; | ||
|
||
public PlayerInteractEntityEvent(Player who, Entity clickedEntity) { | ||
super(Type.PLAYER_INTERACT_ENTITY, who); | ||
this.clickedEntity = clickedEntity; | ||
} | ||
|
||
/** | ||
* Gets the cancellation state of this event. A cancelled event will not | ||
* be executed in the server, but will still pass to other plugins | ||
* | ||
* @return true if this event is cancelled | ||
*/ | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
/** | ||
* Sets the cancellation state of this event. A cancelled event will not | ||
* be executed in the server, but will still pass to other plugins. | ||
* | ||
* @param cancel true if you wish to cancel this event | ||
*/ | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
/** | ||
* Gets the entity that was rightclicked by the player. | ||
* | ||
* @return entity right clicked by player | ||
*/ | ||
public Entity getRightClicked() { | ||
return this.clickedEntity; | ||
} | ||
} |
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
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