Archiviert
13
0

Clone location in PlayerFailMoveEvent getters

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-08-08 13:00:17 +10:00
Ursprung 5274ad672b
Commit ef2b574c6a
5 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerFailMoveEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99822e51bb index 0000000000000000000000000000000000000000..48610aa5eaacfe55e6931aac6f1a6644fb1718ef
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java +++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java
@@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99
+ */ + */
+ @NotNull + @NotNull
+ public Location getFrom() { + public Location getFrom() {
+ return from; + return from.clone();
+ } + }
+ +
+ /** + /**
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99
+ */ + */
+ @NotNull + @NotNull
+ public Location getTo() { + public Location getTo() {
+ return to; + return to.clone();
+ } + }
+ +
+ /** + /**

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerFailMoveEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd2660d7cf21 100644 index 75bd92e1d40588d3bc40fa7837943eec9f2062a6..80e050603e36134754136a8ee2bd14624f976e91 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1404,8 +1404,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1406,8 +1406,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER
double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1;
double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER
@ -19,7 +19,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26
if (this.player.isPassenger()) { if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
@@ -1471,8 +1471,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1473,8 +1473,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Paper start - Prevent moving into unloaded chunks // Paper start - Prevent moving into unloaded chunks
if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
@ -34,7 +34,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26
} }
// Paper end // Paper end
@@ -1481,9 +1487,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1483,9 +1489,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end // CraftBukkit end
@ -51,7 +51,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26
} }
} }
@@ -1548,8 +1561,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1550,8 +1563,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag2 = false; boolean flag2 = false;
if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -67,7 +67,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26
} }
// Paper start - optimise out extra getCubes // Paper start - optimise out extra getCubes
@@ -1562,6 +1582,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1564,6 +1584,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (didCollide || !axisalignedbb.equals(newBox)) { if (didCollide || !axisalignedbb.equals(newBox)) {
// note: only call after setLocation, or else getBoundingBox is wrong // note: only call after setLocation, or else getBoundingBox is wrong
teleportBack = this.hasNewCollision(worldserver, this.player, axisalignedbb, newBox); teleportBack = this.hasNewCollision(worldserver, this.player, axisalignedbb, newBox);
@ -83,7 +83,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26
} // else: no collision at all detected, why do we care? } // else: no collision at all detected, why do we care?
} }
if (!this.player.noPhysics && !this.player.isSleeping() && teleportBack) { // Paper end - optimise out extra getCubes if (!this.player.noPhysics && !this.player.isSleeping() && teleportBack) { // Paper end - optimise out extra getCubes
@@ -1650,6 +1679,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1652,6 +1681,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} }