SPIGOT-8004: .setCancelled(true) does not cancel PlayerTeleportEvent.TeleportCause.SPECTATE
This commit is contained in:
parent
4f3946f7ac
commit
f152cadda7
@ -106,8 +106,8 @@
|
|||||||
+ containerSynchronizer.sendSlotChange(containerMenu, s, getMainHandItem());
|
+ containerSynchronizer.sendSlotChange(containerMenu, s, getMainHandItem());
|
||||||
+ });
|
+ });
|
||||||
+ containerSynchronizer.sendSlotChange(inventoryMenu, ContainerPlayer.SHIELD_SLOT, getOffhandItem());
|
+ containerSynchronizer.sendSlotChange(inventoryMenu, ContainerPlayer.SHIELD_SLOT, getOffhandItem());
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||||
+ // If this is an issue, PRs are welcome
|
+ // If this is an issue, PRs are welcome
|
||||||
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
||||||
@ -144,9 +144,9 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return blockposition;
|
+ return blockposition;
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPosition adjustSpawnLocation(WorldServer worldserver, BlockPosition blockposition) {
|
public BlockPosition adjustSpawnLocation(WorldServer worldserver, BlockPosition blockposition) {
|
||||||
AxisAlignedBB axisalignedbb = this.getDimensions(EntityPose.STANDING).makeBoundingBox(Vec3D.ZERO);
|
AxisAlignedBB axisalignedbb = this.getDimensions(EntityPose.STANDING).makeBoundingBox(Vec3D.ZERO);
|
||||||
@ -544,11 +544,11 @@
|
|||||||
} else {
|
} else {
|
||||||
- return new TeleportTransition(this.server.overworld(), this, teleporttransition_a);
|
- return new TeleportTransition(this.server.overworld(), this, teleporttransition_a);
|
||||||
+ teleportTransition = new TeleportTransition(this.server.overworld(), this, teleporttransition_a); // CraftBukkit
|
+ teleportTransition = new TeleportTransition(this.server.overworld(), this, teleporttransition_a); // CraftBukkit
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (reason == null) {
|
+ if (reason == null) {
|
||||||
+ return teleportTransition;
|
+ return teleportTransition;
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ Player respawnPlayer = this.getBukkitEntity();
|
+ Player respawnPlayer = this.getBukkitEntity();
|
||||||
+ Location location = CraftLocation.toBukkit(teleportTransition.position(), teleportTransition.newLevel().getWorld(), teleportTransition.yRot(), teleportTransition.xRot());
|
+ Location location = CraftLocation.toBukkit(teleportTransition.position(), teleportTransition.newLevel().getWorld(), teleportTransition.yRot(), teleportTransition.xRot());
|
||||||
@ -1078,16 +1078,22 @@
|
|||||||
this.language = clientinformation.language();
|
this.language = clientinformation.language();
|
||||||
this.requestedViewDistance = clientinformation.viewDistance();
|
this.requestedViewDistance = clientinformation.viewDistance();
|
||||||
this.chatVisibility = clientinformation.chatVisibility();
|
this.chatVisibility = clientinformation.chatVisibility();
|
||||||
@@ -1962,7 +2377,7 @@
|
@@ -1962,7 +2377,13 @@
|
||||||
if (world instanceof WorldServer) {
|
if (world instanceof WorldServer) {
|
||||||
WorldServer worldserver = (WorldServer) world;
|
WorldServer worldserver = (WorldServer) world;
|
||||||
|
|
||||||
- this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false);
|
- this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false);
|
||||||
+ this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false, TeleportCause.SPECTATE); // CraftBukkit
|
+ // CraftBukkit start
|
||||||
|
+ boolean result = this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false, TeleportCause.SPECTATE);
|
||||||
|
+ if (!result) {
|
||||||
|
+ this.camera = entity1;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
@@ -1999,11 +2414,11 @@
|
@@ -1999,11 +2420,11 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public IChatBaseComponent getTabListDisplayName() {
|
public IChatBaseComponent getTabListDisplayName() {
|
||||||
@ -1101,7 +1107,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2046,6 +2461,32 @@
|
@@ -2046,6 +2467,32 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||||
@ -1134,7 +1140,7 @@
|
|||||||
if (blockposition != null) {
|
if (blockposition != null) {
|
||||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||||
|
|
||||||
@@ -2088,12 +2529,38 @@
|
@@ -2088,12 +2535,38 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1174,7 +1180,7 @@
|
|||||||
this.level().addFreshEntity(entityitem);
|
this.level().addFreshEntity(entityitem);
|
||||||
ItemStack itemstack1 = entityitem.getItem();
|
ItemStack itemstack1 = entityitem.getItem();
|
||||||
|
|
||||||
@@ -2375,10 +2842,12 @@
|
@@ -2375,10 +2848,12 @@
|
||||||
return TicketType.ENDER_PEARL.timeout();
|
return TicketType.ENDER_PEARL.timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1190,7 +1196,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static float calculateLookAtYaw(Vec3D vec3d, BlockPosition blockposition) {
|
private static float calculateLookAtYaw(Vec3D vec3d, BlockPosition blockposition) {
|
||||||
@@ -2387,4 +2856,146 @@
|
@@ -2387,4 +2862,146 @@
|
||||||
return (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
return (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user