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

@@ -397,7 +397,15 @@
double d0 = this.locX();
double d1 = this.locY();
double d2 = this.locZ();
@@ -593,7 +803,26 @@
@@ -567,6 +777,7 @@
worldserver1.getMethodProfiler().enter("moving");
double d3;
+ if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
if (worldserver.getDimensionKey() == World.THE_END) {
BlockPosition blockposition = WorldServer.a;
@@ -593,7 +804,26 @@
}
}
@@ -425,7 +433,7 @@
worldserver1.getMethodProfiler().exit();
worldserver1.getMethodProfiler().enter("placing");
double d4 = Math.min(-2.9999872E7D, worldserver.getWorldBorder().e() + 16.0D);
@@ -604,25 +833,74 @@
@@ -604,25 +834,74 @@
d0 = MathHelper.a(d0, d4, d5);
d2 = MathHelper.a(d2, d3, d6);
@@ -512,7 +520,7 @@
this.playerInteractManager.a(worldserver);
this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities));
playerlist.a(this, worldserver);
@@ -639,6 +917,11 @@
@@ -639,6 +918,11 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@@ -524,7 +532,7 @@
return this;
}
}
@@ -680,10 +963,8 @@
@@ -680,10 +964,8 @@
this.activeContainer.c();
}
@@ -537,7 +545,7 @@
if (!this.isSleeping() && this.isAlive()) {
if (!this.world.getDimensionManager().isNatural()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
@@ -709,7 +990,36 @@
@@ -709,7 +991,36 @@
}
}
@@ -575,7 +583,7 @@
this.a(StatisticList.SLEEP_IN_BED);
CriterionTriggers.q.a(this);
});
@@ -718,9 +1028,8 @@
@@ -718,9 +1029,8 @@
return either;
}
}
@@ -586,7 +594,7 @@
}
@Override
@@ -747,6 +1056,7 @@
@@ -747,6 +1057,7 @@
@Override
public void wakeup(boolean flag, boolean flag1) {
@@ -594,7 +602,7 @@
if (this.isSleeping()) {
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
}
@@ -818,8 +1128,9 @@
@@ -818,8 +1129,9 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@@ -605,7 +613,7 @@
}
@Override
@@ -834,6 +1145,24 @@
@@ -834,6 +1146,24 @@
this.nextContainerCounter();
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
@@ -630,7 +638,7 @@
if (container == null) {
if (this.isSpectator()) {
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
@@ -841,9 +1170,11 @@
@@ -841,9 +1171,11 @@
return OptionalInt.empty();
} else {
@@ -644,7 +652,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -856,13 +1187,24 @@
@@ -856,13 +1188,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -671,7 +679,7 @@
this.activeContainer.addSlotListener(this);
}
@@ -907,6 +1249,11 @@
@@ -907,6 +1250,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@@ -683,7 +691,7 @@
}
@Override
@@ -916,6 +1263,7 @@
@@ -916,6 +1264,7 @@
@Override
public void closeInventory() {
@@ -691,7 +699,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.o();
}
@@ -950,7 +1298,7 @@
@@ -950,7 +1299,7 @@
@Override
public void a(Statistic<?> statistic, int i) {
this.serverStatisticManager.b(this, statistic, i);
@@ -700,7 +708,7 @@
scoreboardscore.addScore(i);
});
}
@@ -958,7 +1306,7 @@
@@ -958,7 +1307,7 @@
@Override
public void a(Statistic<?> statistic) {
this.serverStatisticManager.setStatistic(this, statistic, 0);
@@ -709,7 +717,7 @@
}
@Override
@@ -1007,7 +1355,16 @@
@@ -1007,7 +1356,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@@ -726,7 +734,7 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
@@ -1062,12 +1419,14 @@
@@ -1062,12 +1420,14 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@@ -742,7 +750,7 @@
}
@Override
@@ -1135,6 +1494,18 @@
@@ -1135,6 +1495,18 @@
@Override
public void a(EnumGamemode enumgamemode) {
@@ -761,7 +769,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1184,7 +1555,20 @@
@@ -1184,7 +1556,20 @@
return s;
}
@@ -782,7 +790,7 @@
this.cf = packetplayinsettings.d();
this.cg = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f());
@@ -1220,13 +1604,13 @@
@@ -1220,13 +1605,13 @@
if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else {
@@ -798,7 +806,7 @@
}
@Override
@@ -1250,7 +1634,7 @@
@@ -1250,7 +1635,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@@ -807,7 +815,7 @@
}
}
@@ -1279,7 +1663,7 @@
@@ -1279,7 +1664,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@@ -816,7 +824,7 @@
}
@Override
@@ -1300,9 +1684,16 @@
@@ -1300,9 +1685,16 @@
return this.advancementDataPlayer;
}
@@ -833,7 +841,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
@@ -1323,6 +1714,9 @@
@@ -1323,6 +1715,9 @@
this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this);
}
@@ -843,7 +851,7 @@
}
@@ -1409,4 +1803,144 @@
@@ -1409,4 +1804,144 @@
return entityitem;
}
}