SPIGOT-6157: Crash when PortalCreateEvent cancelled
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,10 +149,19 @@
|
||||
@@ -136,10 +149,20 @@
|
||||
for (j1 = 0; j1 < 2; ++j1) {
|
||||
for (j = 0; j < 3; ++j) {
|
||||
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition1, j1 * enumdirection.getAdjacentX(), j, j1 * enumdirection.getAdjacentZ());
|
||||
@@ -84,9 +84,10 @@
|
||||
+ 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, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.NETHER_PAIR);
|
||||
+
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ blockList.updateList();
|
||||
+ if (event.isCancelled()) {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ blockList.updateList();
|
||||
+ // CraftBukkit end
|
||||
return Optional.of(new BlockUtil.Rectangle(blockposition1.immutableCopy(), 2, 3));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user