mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
SPIGOT-6157: Crash when PortalCreateEvent cancelled
This commit is contained in:
parent
a339310c48
commit
1ee373fe28
@ -499,7 +499,7 @@
|
|||||||
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
||||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||||
|
|
||||||
@@ -631,14 +886,14 @@
|
@@ -631,17 +886,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -517,7 +517,11 @@
|
|||||||
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getTravelAgent().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
|
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getTravelAgent().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
|
||||||
|
|
||||||
if (!optional1.isPresent()) {
|
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 @@
|
@@ -685,10 +940,8 @@
|
||||||
this.activeContainer.c();
|
this.activeContainer.c();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,10 +149,19 @@
|
@@ -136,10 +149,20 @@
|
||||||
for (j1 = 0; j1 < 2; ++j1) {
|
for (j1 = 0; j1 < 2; ++j1) {
|
||||||
for (j = 0; j < 3; ++j) {
|
for (j = 0; j < 3; ++j) {
|
||||||
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition1, j1 * enumdirection.getAdjacentX(), j, j1 * enumdirection.getAdjacentZ());
|
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);
|
+ 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);
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
+ if (!event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ blockList.updateList();
|
+ return Optional.empty();
|
||||||
+ }
|
+ }
|
||||||
|
+ blockList.updateList();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
return Optional.of(new BlockUtil.Rectangle(blockposition1.immutableCopy(), 2, 3));
|
return Optional.of(new BlockUtil.Rectangle(blockposition1.immutableCopy(), 2, 3));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user