Archiviert
13
0

SPIGOT-6157: Crash when PortalCreateEvent cancelled

Dieser Commit ist enthalten in:
md_5 2020-09-29 18:10:57 +10:00
Ursprung a339310c48
Commit 1ee373fe28
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11
2 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -499,7 +499,7 @@
private void a(WorldServer worldserver, BlockPosition blockposition) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
@@ -631,14 +886,14 @@
@@ -631,17 +886,17 @@
}
@Override
@ -517,7 +517,11 @@
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getTravelAgent().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
if (!optional1.isPresent()) {
EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder");
- EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder");
+ // EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder"); // CraftBukkit
}
return optional1;
@@ -685,10 +940,8 @@
this.activeContainer.c();
}

Datei anzeigen

@ -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));
}