Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Portals created by fire now trigger PortalCreateEvent.
Dieser Commit ist enthalten in:
Ursprung
b94bb27663
Commit
a5dd42adb9
@ -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) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren