mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
580a610550
When enabled, ender pearls will not load chunks and will save to the world instead of the player. Also changes the exploit config to be default false, as it only makes sense when legacy behavior is enabled.
49 lines
2.9 KiB
Diff
49 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 30 Apr 2018 17:15:26 -0400
|
|
Subject: [PATCH] Block Enderpearl Travel Exploit
|
|
|
|
Players are able to use alt accounts and enderpearls to travel
|
|
long distances utilizing the pearls in unloaded chunks and loading
|
|
the chunk later when convenient.
|
|
|
|
This disables that by not saving the thrower when the chunk is unloaded.
|
|
|
|
This is mainly useful for survival servers that do not allow freeform teleporting.
|
|
|
|
Note: Currently removed as enderpearls are ticked as long as their owner is online in 1.21.2.
|
|
Might be worth to re-add once an option to disable the above vanilla mechanic is added, to
|
|
fully prevent enderpearl travel exploits.
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.projectile.Projectile ownerUUID
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index e65cfb1132f5f0c9e1fa5ae4a46a8abed0c56be1..d5b9db881a49612c7587f8821adf923e28791d07 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2658,6 +2658,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
|
|
public void onTickingEnd(Entity entity) {
|
|
ServerLevel.this.entityTickList.remove(entity);
|
|
+ // Paper start - Reset pearls when they stop being ticked
|
|
+ if (ServerLevel.this.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && ServerLevel.this.paperConfig().misc.legacyEnderPearlBehavior && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
|
|
+ pearl.cachedOwner = null;
|
|
+ pearl.ownerUUID = null;
|
|
+ }
|
|
+ // Paper end - Reset pearls when they stop being ticked
|
|
}
|
|
|
|
public void onTrackingStart(Entity entity) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
index bf2e79c50092acd13e97ab6e32471a9c527a524e..6c2d4d6f3a36ab452dfd3c33f66e54f152906639 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -134,6 +134,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
|
protected void readAdditionalSaveData(CompoundTag nbt) {
|
|
if (nbt.hasUUID("Owner")) {
|
|
this.setOwnerThroughUUID(nbt.getUUID("Owner"));
|
|
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && this.level().paperConfig().misc.legacyEnderPearlBehavior) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
|
|
}
|
|
|
|
this.leftOwner = nbt.getBoolean("LeftOwner");
|