summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/BlockPortal.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index 2afd5061..4bc78f44 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -3,10 +3,12 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
+import java.util.ArrayList;
+
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.event.world.PortalCreateEvent;
// CraftBukkit end
public class BlockPortal extends BlockBreakable {
@@ -57,6 +59,11 @@ public class BlockPortal extends BlockBreakable {
if (b0 == b1) {
return false;
} else {
+ // CraftBukkit start
+ java.util.ArrayList<org.bukkit.block.Block> blocks = new ArrayList<org.bukkit.block.Block>();
+ CraftWorld craftWorld = world.getWorld();
+ // CraftBukkit end
+
if (world.getTypeId(i - b0, j, k - b1) == 0) {
i -= b0;
k -= b1;
@@ -75,6 +82,13 @@ public class BlockPortal extends BlockBreakable {
if (flag) {
if (j1 != Block.OBSIDIAN.id) {
return false;
+ } else {
+ // CraftBukkit start
+ org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
+ if (!blocks.contains(b)) {
+ blocks.add(b);
+ }
+ // CraftBukkit end
}
} else if (j1 != 0 && j1 != Block.FIRE.id) {
return false;
@@ -83,6 +97,23 @@ public class BlockPortal extends BlockBreakable {
}
}
+ // CraftBukkit start
+ for (l = 0; l < 2; ++l) {
+ for (i1 = 0; i1 < 3; ++i1) {
+ org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
+ if (!blocks.contains(b)) {
+ blocks.add(b);
+ }
+ }
+ }
+
+ PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }
+ // CraftBukkit end
+
world.o = true;
for (l = 0; l < 2; ++l) {