aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0214-Block-Enderpearl-Travel-Exploit.patch
blob: a17b0976b44df4fb5193c1749f4728f223bfadc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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.

diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 873f81c74a94f6d76edd45e34ddc476dc525b47c..69009246f12cc3acb0055af746e01097fa668e1b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -356,4 +356,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/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
index acdc5dcb18ade293923ef37dc8c29e96c0213942..dd4595ed07821f996e5a677dad5882656e19e7a2 100644
--- a/src/main/java/net/minecraft/server/IProjectile.java
+++ b/src/main/java/net/minecraft/server/IProjectile.java
@@ -48,6 +48,7 @@ public abstract class IProjectile extends Entity {
     protected void loadData(NBTTagCompound nbttagcompound) {
         if (nbttagcompound.b("Owner")) {
             this.shooter = nbttagcompound.a("Owner");
+            if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooter = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
         }
 
         this.d = nbttagcompound.getBoolean("LeftOwner");