Rearchitect PortalCreateEvent to provide more information about the portal

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-05-05 10:51:43 +10:00
parent 8c6028095a
commit 2beeb67ce0
3 changed files with 59 additions and 63 deletions

View File

@@ -26,7 +26,7 @@
}
}
}
@@ -291,10 +292,23 @@
@@ -291,10 +292,19 @@
for (i3 = 0; i3 < 2; ++i3) {
for (l2 = 0; l2 < 3; ++l2) {
blockposition_mutableblockposition.d(i5 + i3 * k5, j5 + l2, j2 + i3 * l5);
@@ -37,12 +37,8 @@
+ // CraftBukkit start
+ org.bukkit.World bworld = this.world.getWorld();
+ java.util.List<org.bukkit.block.Block> bukkitBlocks = com.google.common.collect.Lists.newArrayList();
+ for (BlockPosition cpos : blockList.getBlocks()) {
+ bukkitBlocks.add(bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ()));
+ }
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blockList.getList(), bworld, org.bukkit.event.world.PortalCreateEvent.CreateReason.NETHER_PAIR);
+
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent(bukkitBlocks, bworld, org.bukkit.event.world.PortalCreateEvent.CreateReason.OBC_DESTINATION);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ blockList.updateList();