SPIGOT-5816: PlayerTeleportEvent not called when using netherportals and allow-nether=false

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-06-26 08:30:47 +10:00
parent 292593e180
commit be27330b16
2 changed files with 69 additions and 57 deletions

View File

@@ -1,12 +1,11 @@
--- a/net/minecraft/server/Entity.java
+++ b/net/minecraft/server/Entity.java
@@ -21,8 +21,57 @@
@@ -21,8 +21,56 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Server;
+import org.bukkit.block.BlockFace;
+import org.bukkit.command.CommandSender;
@@ -58,7 +57,7 @@
protected static final Logger LOGGER = LogManager.getLogger();
private static final AtomicInteger entityCount = new AtomicInteger();
private static final List<ItemStack> c = Collections.emptyList();
@@ -111,6 +160,20 @@
@@ -111,6 +159,20 @@
private long aG;
private EntitySize size;
private float headHeight;
@@ -79,7 +78,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.entityCount.incrementAndGet();
@@ -214,6 +277,12 @@
@@ -214,6 +276,12 @@
}
public void setPose(EntityPose entitypose) {
@@ -92,7 +91,7 @@
this.datawatcher.set(Entity.POSE, entitypose);
}
@@ -230,6 +299,33 @@
@@ -230,6 +298,33 @@
}
protected void setYawPitch(float f, float f1) {
@@ -126,7 +125,7 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -240,6 +336,7 @@
@@ -240,6 +335,7 @@
float f1 = this.size.height;
this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
@@ -134,7 +133,7 @@
}
protected void ac() {
@@ -254,6 +351,15 @@
@@ -254,6 +350,15 @@
this.entityBaseTick();
}
@@ -150,7 +149,7 @@
public void entityBaseTick() {
this.world.getMethodProfiler().enter("entityBaseTick");
if (this.isPassenger() && this.getVehicle().dead) {
@@ -267,7 +373,7 @@
@@ -267,7 +372,7 @@
this.z = this.A;
this.lastPitch = this.pitch;
this.lastYaw = this.yaw;
@@ -159,7 +158,7 @@
if (this.aK()) {
this.aL();
}
@@ -322,12 +428,44 @@
@@ -322,12 +427,44 @@
protected void burnFromLava() {
if (!this.isFireProof()) {
@@ -205,7 +204,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -424,6 +562,28 @@
@@ -424,6 +561,28 @@
block.a((IBlockAccess) this.world, this);
}
@@ -234,7 +233,7 @@
if (this.onGround && !this.br()) {
block.stepOn(this.world, blockposition, this);
}
@@ -698,6 +858,7 @@
@@ -698,6 +857,7 @@
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
@@ -242,7 +241,7 @@
}
protected SoundEffect getSoundSwim() {
@@ -1036,6 +1197,13 @@
@@ -1036,6 +1196,13 @@
}
public void spawnIn(World world) {
@@ -256,7 +255,7 @@
this.world = world;
}
@@ -1051,6 +1219,7 @@
@@ -1051,6 +1218,7 @@
this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
@@ -264,7 +263,7 @@
}
public void c(Vec3D vec3d) {
@@ -1225,6 +1394,12 @@
@@ -1225,6 +1393,12 @@
return false;
}
@@ -277,7 +276,7 @@
public void a(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
@@ -1235,7 +1410,7 @@
@@ -1235,7 +1409,7 @@
public boolean a_(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@@ -286,7 +285,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1259,6 +1434,18 @@
@@ -1259,6 +1433,18 @@
Vec3D vec3d = this.getMot();
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
@@ -305,7 +304,7 @@
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1267,6 +1454,12 @@
@@ -1267,6 +1453,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@@ -318,7 +317,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1324,6 +1517,11 @@
@@ -1324,6 +1516,11 @@
}
}
@@ -330,7 +329,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1401,6 +1599,43 @@
@@ -1401,6 +1598,43 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -374,7 +373,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1476,9 +1711,22 @@
@@ -1476,9 +1710,22 @@
} else if (this.world.isClientSide) {
return null;
} else {
@@ -397,7 +396,7 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1559,7 +1807,7 @@
@@ -1559,7 +1806,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@@ -406,7 +405,7 @@
return true;
}
}
@@ -1584,7 +1832,7 @@
@@ -1584,7 +1831,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -415,7 +414,7 @@
}
}
@@ -1593,10 +1841,31 @@
@@ -1593,10 +1840,31 @@
this.bb();
}
@@ -448,7 +447,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1604,15 +1873,33 @@
@@ -1604,15 +1872,33 @@
}
}
@@ -483,7 +482,12 @@
}
protected boolean q(Entity entity) {
@@ -1665,7 +1952,13 @@
@@ -1661,11 +1947,17 @@
ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
- if (worldserver1 != null && minecraftserver.getAllowNether() && !this.isPassenger() && this.portalTicks++ >= i) {
+ if (true && !this.isPassenger() && this.portalTicks++ >= i) { // CraftBukkit
this.world.getMethodProfiler().enter("portal");
this.portalTicks = i;
this.portalCooldown = this.getDefaultPortalCooldown();
@@ -498,7 +502,7 @@
this.world.getMethodProfiler().exit();
}
@@ -1765,6 +2058,13 @@
@@ -1765,6 +2057,13 @@
}
public void setSwimming(boolean flag) {
@@ -512,7 +516,7 @@
this.setFlag(4, flag);
}
@@ -1825,16 +2125,56 @@
@@ -1825,16 +2124,56 @@
}
public void setAirTicks(int i) {
@@ -572,7 +576,7 @@
}
public void k(boolean flag) {
@@ -1986,18 +2326,45 @@
@@ -1986,18 +2325,45 @@
@Nullable
public Entity a(WorldServer worldserver) {
@@ -622,7 +626,7 @@
} else {
double d0 = this.locX();
double d1 = this.locZ();
@@ -2023,7 +2390,16 @@
@@ -2023,7 +2389,16 @@
Vec3D vec3d1 = this.getPortalOffset();
blockposition = new BlockPosition(d0, this.locY(), d1);
@@ -640,7 +644,7 @@
if (shapedetector_shape == null) {
return null;
@@ -2033,6 +2409,11 @@
@@ -2033,6 +2408,11 @@
vec3d = shapedetector_shape.velocity;
f = (float) shapedetector_shape.yaw;
}
@@ -652,7 +656,7 @@
this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver);
@@ -2043,8 +2424,16 @@
@@ -2043,8 +2423,16 @@
entity.setMot(vec3d);
worldserver.addEntityTeleport(entity);
if (worldserver.getDimensionKey() == World.THE_END) {
@@ -670,7 +674,7 @@
}
this.bJ();
@@ -2253,7 +2642,26 @@
@@ -2253,7 +2641,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {