mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 09:51:12 +01:00
SPIGOT-5562: Entering a boat triggers VehicleExitEvent
This patch prevents entities from riding a vehicle they're already riding on. When trying to enter a boat the client will send up to two packets for each hand causing the server to think they should enter the boat twice, despite the first interaction being sufficient.
This commit is contained in:
parent
7ea3c040bc
commit
847ad16eed
1 changed files with 18 additions and 12 deletions
|
@ -384,7 +384,13 @@
|
||||||
this.world.addEntity(entityitem);
|
this.world.addEntity(entityitem);
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
@@ -1559,7 +1801,7 @@
|
@@ -1554,12 +1796,13 @@
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (this.isPassenger()) {
|
||||||
|
+ if (this.vehicle == entity) return true; // CraftBukkit - SPIGOT-5562: already riding
|
||||||
|
this.stopRiding();
|
||||||
|
}
|
||||||
|
|
||||||
this.setPose(EntityPose.STANDING);
|
this.setPose(EntityPose.STANDING);
|
||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
|
@ -393,7 +399,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1584,7 +1826,7 @@
|
@@ -1584,7 +1827,7 @@
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
|
@ -402,7 +408,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1593,10 +1835,31 @@
|
@@ -1593,10 +1836,31 @@
|
||||||
this.bb();
|
this.bb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +441,7 @@
|
||||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
||||||
this.passengers.add(0, entity);
|
this.passengers.add(0, entity);
|
||||||
} else {
|
} else {
|
||||||
@@ -1604,15 +1867,33 @@
|
@@ -1604,15 +1868,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,7 +476,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean q(Entity entity) {
|
protected boolean q(Entity entity) {
|
||||||
@@ -1665,7 +1946,13 @@
|
@@ -1665,7 +1947,13 @@
|
||||||
this.world.getMethodProfiler().enter("portal");
|
this.world.getMethodProfiler().enter("portal");
|
||||||
this.portalTicks = i;
|
this.portalTicks = i;
|
||||||
this.portalCooldown = this.getDefaultPortalCooldown();
|
this.portalCooldown = this.getDefaultPortalCooldown();
|
||||||
|
@ -485,7 +491,7 @@
|
||||||
this.world.getMethodProfiler().exit();
|
this.world.getMethodProfiler().exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1765,6 +2052,13 @@
|
@@ -1765,6 +2053,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean flag) {
|
public void setSwimming(boolean flag) {
|
||||||
|
@ -499,7 +505,7 @@
|
||||||
this.setFlag(4, flag);
|
this.setFlag(4, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1825,16 +2119,56 @@
|
@@ -1825,16 +2120,56 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int i) {
|
public void setAirTicks(int i) {
|
||||||
|
@ -559,7 +565,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void k(boolean flag) {
|
public void k(boolean flag) {
|
||||||
@@ -1986,18 +2320,45 @@
|
@@ -1986,18 +2321,45 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Entity a(WorldServer worldserver) {
|
public Entity a(WorldServer worldserver) {
|
||||||
|
@ -609,7 +615,7 @@
|
||||||
} else {
|
} else {
|
||||||
double d0 = this.locX();
|
double d0 = this.locX();
|
||||||
double d1 = this.locZ();
|
double d1 = this.locZ();
|
||||||
@@ -2023,7 +2384,16 @@
|
@@ -2023,7 +2385,16 @@
|
||||||
Vec3D vec3d1 = this.getPortalOffset();
|
Vec3D vec3d1 = this.getPortalOffset();
|
||||||
|
|
||||||
blockposition = new BlockPosition(d0, this.locY(), d1);
|
blockposition = new BlockPosition(d0, this.locY(), d1);
|
||||||
|
@ -627,7 +633,7 @@
|
||||||
|
|
||||||
if (shapedetector_shape == null) {
|
if (shapedetector_shape == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -2033,6 +2403,11 @@
|
@@ -2033,6 +2404,11 @@
|
||||||
vec3d = shapedetector_shape.velocity;
|
vec3d = shapedetector_shape.velocity;
|
||||||
f = (float) shapedetector_shape.yaw;
|
f = (float) shapedetector_shape.yaw;
|
||||||
}
|
}
|
||||||
|
@ -639,7 +645,7 @@
|
||||||
|
|
||||||
this.world.getMethodProfiler().exitEnter("reloading");
|
this.world.getMethodProfiler().exitEnter("reloading");
|
||||||
Entity entity = this.getEntityType().a((World) worldserver);
|
Entity entity = this.getEntityType().a((World) worldserver);
|
||||||
@@ -2043,8 +2418,16 @@
|
@@ -2043,8 +2419,16 @@
|
||||||
entity.setMot(vec3d);
|
entity.setMot(vec3d);
|
||||||
worldserver.addEntityTeleport(entity);
|
worldserver.addEntityTeleport(entity);
|
||||||
if (worldserver.getDimensionKey() == World.THE_END) {
|
if (worldserver.getDimensionKey() == World.THE_END) {
|
||||||
|
@ -657,7 +663,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bJ();
|
this.bJ();
|
||||||
@@ -2253,7 +2636,26 @@
|
@@ -2253,7 +2637,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
|
|
Loading…
Reference in a new issue