force entity dismount during teleportation

Entities must be dismounted before teleportation in order to avoid
multiple issues in the server with regards to teleportation, shamefully,
too many plugins rely on the events firing, which means that not firing
these events caues more issues than it solves;

In order to counteract this, Entity dismount/exit vehicle events have
been modified to supress cancellation (and has a method to allow plugins
to check if this has been set), noting that cancellation will be silently
surpressed given that plugins are not expecting this event to not be cancellable.

This is a far from ideal scenario, however: given the current state of this
event and other alternatives causing issues elsewhere, I believe that
this is going to be the best soultion all around.

Improvements/suggestions welcome!
This commit is contained in:
Shane Freeder
2018-11-15 13:38:37 +00:00
parent f944b0b8d6
commit 373c8ff0b2
5 changed files with 248 additions and 157 deletions

View File

@@ -13,7 +13,22 @@
public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, Enemy {
@@ -402,6 +408,14 @@
@@ -283,7 +289,13 @@
@Override
public void stopRiding() {
- super.stopRiding();
+ // Paper start - Force entity dismount during teleportation
+ this.stopRiding(false);
+ }
+ @Override
+ public void stopRiding(boolean suppressCancellation) {
+ super.stopRiding(suppressCancellation);
+ // Paper end - Force entity dismount during teleportation
if (this.level().isClientSide) {
this.clientOldAttachPosition = this.blockPosition();
}
@@ -402,6 +414,14 @@
Direction enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
@@ -28,7 +43,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -472,7 +486,7 @@
@@ -472,7 +492,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);