diff --git a/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch new file mode 100644 index 0000000000..2132d8fb25 --- /dev/null +++ b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Thu, 15 Nov 2018 13:38:37 +0000 +Subject: [PATCH] force entity dismount during teleportation + +Entities must be dismounted before teleportation in order to avoid +multiple issues in the server with regards to teleportation, while +we now lose the ability for plugins to monitor this specific case +of entity dismount, the alternative is that we allow a cancellable +event, but silently ignore the cancelled status, which might cause +further issues for plugins tracking state + +Given that nobody can be relying on the Cancellable state of those +events during teleportation due to the issues that arise from this, +this is a small trade off + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 32b90f30d9..2377175f83 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + + } + +- public void stopRiding() { ++ // Paper start ++ public void stopRiding() { stopRiding(false); } ++ public void stopRiding(boolean force) { ++ // Paper end + if (this.vehicle != null) { + Entity entity = this.vehicle; + + this.vehicle = null; +- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit ++ if (!entity.removePassenger(this, force)) this.vehicle = entity; // CraftBukkit // Paper + } + + } +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return true; // CraftBukkit + } + +- protected boolean removePassenger(Entity entity) { // CraftBukkit ++ // Paper start ++ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);} ++ protected boolean removePassenger(Entity entity, boolean force) { // CraftBukkit ++ // Paper end + if (entity.getVehicle() == this) { + throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); + } else { ++ if (!force) { // Paper + // CraftBukkit start + CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); + Entity orig = craft == null ? null : craft.getHandle(); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + if (event.isCancelled()) { + return false; + } ++ } // Paper + // Spigot end + this.passengers.remove(entity); + entity.k = 60; +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 4490b63258..4fcbbae7d4 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + } + +- public void stopRiding() { ++ // Paper start ++ public void stopRiding() { stopRiding(false);}; ++ public void stopRiding(boolean force) { ++ // paper end + Entity entity = this.getVehicle(); + +- super.stopRiding(); ++ super.stopRiding(force); // Paper + Entity entity1 = this.getVehicle(); + + if (entity1 != entity && this.playerConnection != null) { +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 73bd0dc4a1..ec52f385eb 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + } + + public EntityPlayer moveToWorld(EntityPlayer entityplayer, DimensionManager dimensionmanager, boolean flag, Location location, boolean avoidSuffocation) { +- entityplayer.stopRiding(); // CraftBukkit ++ entityplayer.stopRiding(true); // CraftBukkit // Paper + entityplayer.getWorldServer().getTracker().untrackPlayer(entityplayer); + // entityplayer.getWorldServer().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.getWorldServer().getPlayerChunkMap().removePlayer(entityplayer); +-- \ No newline at end of file