#724: Re-implement player portal event search radius and creation API

This also fixes that the nether/end portals would be created even if the
event was cancelled as well as that the EntityPortalEvent would be
called for player portal usage which is not according to its API
specification

By: Phoenix616 <max@themoep.de>
This commit is contained in:
CraftBukkit/Spigot
2020-08-14 08:26:40 +10:00
parent 44ebf1c058
commit c9673f0556
6 changed files with 215 additions and 130 deletions

View File

@@ -7,7 +7,7 @@
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.block.CraftBlockState;
+import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
+import org.bukkit.event.world.PortalCreateEvent;
+// CraftBukkit end
+
@@ -62,11 +62,20 @@
}
public boolean c() {
@@ -194,7 +221,7 @@
return new Vec3D(d2, d3, d4);
}
- public static ShapeDetectorShape a(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1) {
+ public static ShapeDetectorShape a(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1, CraftPortalEvent portalEventInfo) { // CraftBukkit // PAIL rename toDetectorShape
BlockPosition blockposition = blockutil_rectangle.origin;
IBlockData iblockdata = worldserver.getType(blockposition);
EnumDirection.EnumAxis enumdirection_enumaxis1 = (EnumDirection.EnumAxis) iblockdata.get(BlockProperties.E);
@@ -208,6 +235,6 @@
boolean flag = enumdirection_enumaxis1 == EnumDirection.EnumAxis.X;
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
- return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1);
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver); // CraftBukkit
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver, portalEventInfo); // CraftBukkit
}
}