@@ -5,10 +5,7 @@ import org.bukkit.entity.Painting;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed by an entity
|
||||
*
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
|
||||
public class PaintingBreakByEntityEvent extends PaintingBreakEvent {
|
||||
private Entity remover;
|
||||
|
||||
@@ -17,6 +14,11 @@ public class PaintingBreakByEntityEvent extends PaintingBreakEvent {
|
||||
this.remover = remover;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity that removed the painting
|
||||
*
|
||||
* @return the entity that removed the painting.
|
||||
*/
|
||||
public Entity getRemover() {
|
||||
return remover;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ import org.bukkit.entity.Painting;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed by the world (water flowing over it, block damaged behind it)
|
||||
*
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
|
||||
public class PaintingBreakByWorldEvent extends PaintingBreakEvent {
|
||||
public PaintingBreakByWorldEvent(final Painting painting) {
|
||||
super(painting, RemoveCause.WORLD);
|
||||
|
||||
@@ -6,10 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed
|
||||
*
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
|
||||
public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
@@ -20,14 +17,31 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cause for the painting's removal
|
||||
*
|
||||
* @return the RemoveCause for the painting's removal
|
||||
*/
|
||||
public RemoveCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
@@ -36,13 +50,12 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
* An enum to specify the cause of the removal
|
||||
*/
|
||||
public enum RemoveCause {
|
||||
|
||||
/**
|
||||
* Removed by an entity
|
||||
*/
|
||||
ENTITY,
|
||||
/**
|
||||
* Removed by the world - block destroyed behind, water flowing over etc
|
||||
* Removed by the world - block the painting is on is destroyed, water flowing over etc
|
||||
*/
|
||||
WORLD
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Represents a painting-related event.
|
||||
*
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
public class PaintingEvent extends Event {
|
||||
|
||||
@@ -18,7 +16,7 @@ public class PaintingEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the painting.
|
||||
* Gets the painting involved in this event.
|
||||
*
|
||||
* @return the painting
|
||||
*/
|
||||
|
||||
@@ -10,8 +10,6 @@ import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is created in the world
|
||||
*
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
||||
|
||||
@@ -38,7 +36,7 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block painting placed on
|
||||
* Returns the block that the painting was placed on
|
||||
*
|
||||
* @return Block returns the block painting placed on
|
||||
*/
|
||||
@@ -55,10 +53,22 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user