From cd1da8ec0aaa537d101490c3713e2c21b09682b8 Mon Sep 17 00:00:00 2001 From: Aikar 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. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 9ff73d531c..16e601f7e9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -406,4 +406,10 @@ public class PaperWorldConfig { private void disableSprintInterruptionOnAttack() { disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); } + + public boolean disableEnderpearlExploit = true; + private void disableEnderpearlExploit() { + disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit); + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + } } diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index fc8c0cab55..dd8af4be80 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -242,6 +242,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile { if (nbttagcompound.hasKeyOfType("owner", 10)) { this.shooterId = GameProfileSerializer.b(nbttagcompound.getCompound("owner")); } + if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterId = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit } -- 2.18.0