summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSam Wilson <sam.wilson@gmail.com>2011-12-25 22:11:15 -0800
committerEvilSeph <evilseph@gmail.com>2012-02-26 15:19:29 -0500
commitffb24d94b0a8591e1088f043570d2a66dcea5908 (patch)
tree194eca0167322797156dca9c6a619c9568f68d0b /src/main
parent56d628be91398c3c3d33da15d0a2fb258a313e7c (diff)
downloadbukkit-ffb24d94b0a8591e1088f043570d2a66dcea5908.tar
bukkit-ffb24d94b0a8591e1088f043570d2a66dcea5908.tar.gz
bukkit-ffb24d94b0a8591e1088f043570d2a66dcea5908.tar.lz
bukkit-ffb24d94b0a8591e1088f043570d2a66dcea5908.tar.xz
bukkit-ffb24d94b0a8591e1088f043570d2a66dcea5908.zip
Add a CreateReason to PortalCreateEvent. Addresses BUKKIT-833
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/event/world/PortalCreateEvent.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/event/world/PortalCreateEvent.java b/src/main/java/org/bukkit/event/world/PortalCreateEvent.java
index a2ef5ab0..6f1183a7 100644
--- a/src/main/java/org/bukkit/event/world/PortalCreateEvent.java
+++ b/src/main/java/org/bukkit/event/world/PortalCreateEvent.java
@@ -9,16 +9,19 @@ import java.util.ArrayList;
import java.util.Collection;
/**
- * Called when the world attempts to create a matching end to a portal
+ * Called when a portal is created
*/
public class PortalCreateEvent extends WorldEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false;
private final ArrayList<Block> blocks = new ArrayList<Block>();
+ private CreateReason reason = CreateReason.FIRE;
- public PortalCreateEvent(final Collection<Block> blocks, final World world) {
+ public PortalCreateEvent(final Collection<Block> blocks, final World world, CreateReason reason) {
super(world);
+
this.blocks.addAll(blocks);
+ this.reason = reason;
}
/**
@@ -38,6 +41,15 @@ public class PortalCreateEvent extends WorldEvent implements Cancellable {
this.cancel = cancel;
}
+ /**
+ * Gets the reason for the portal's creation
+ *
+ * @return CreateReason for the portal's creation
+ */
+ public CreateReason getReason() {
+ return reason;
+ }
+
@Override
public HandlerList getHandlers() {
return handlers;
@@ -46,4 +58,18 @@ public class PortalCreateEvent extends WorldEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
+
+ /**
+ * An enum to specify the various reasons for a portal's creation
+ */
+ public enum CreateReason {
+ /**
+ * When a portal is created 'traditionally' due to a portal frame being set on fire.
+ */
+ FIRE,
+ /**
+ * When a portal is created as a destination for an existing portal when using the custom PortalTravelAgent
+ */
+ OBC_DESTINATION
+ }
}