mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
46 lines
2.5 KiB
Diff
46 lines
2.5 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.
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.projectile.Projectile cachedOwner
|
|
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 c63df0042b23e3728d5283b563889225691f6d56..8afcd4e3a3805c7bccffaf6ff751e23101db6ed8 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2368,6 +2368,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
public void onTickingEnd(Entity entity) {
|
|
ServerLevel.this.entityTickList.remove(entity);
|
|
+ // Paper start - Reset pearls when they stop being ticked
|
|
+ if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
|
|
+ pearl.cachedOwner = null;
|
|
+ pearl.ownerUUID = null;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
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 fbbb1fa3d5f4ace67fee96aa235cec3b39deb7b1..e8620ad6be2dda7fe288f884c4ae88a924be4a62 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -101,6 +101,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
|
if (nbt.hasUUID("Owner")) {
|
|
this.ownerUUID = nbt.getUUID("Owner");
|
|
this.cachedOwner = null;
|
|
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
|
|
}
|
|
|
|
this.leftOwner = nbt.getBoolean("LeftOwner");
|