aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0076-Configurable-Non-Player-Arrow-Despawn-Rate.patch
blob: 7d977f4bf57b571783c73d298ffbfbb3ddb72a25 (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
41
From 9b1484edac9a42041e0eab60eb6f5e63ec64ccb7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 15:12:22 -0400
Subject: [PATCH] Configurable Non Player Arrow Despawn Rate

Can set a much shorter despawn rate for arrows that players can not pick up.

diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0873febb6..b37b5901b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -254,4 +254,13 @@ public class PaperWorldConfig {
     private void allowLeashingUndeadHorse() {
         allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false);
     }
+
+    public int nonPlayerArrowDespawnRate = -1;
+    private void nonPlayerArrowDespawnRate() {
+        nonPlayerArrowDespawnRate = getInt("non-player-arrow-despawn-rate", -1);
+        if (nonPlayerArrowDespawnRate == -1) {
+            nonPlayerArrowDespawnRate = spigotConfig.arrowDespawnRate;
+        }
+        log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 65689f26d..8cda47518 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -157,7 +157,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
                 this.ay = 0;
             } else {
                 ++this.ax;
-                if (this.ax >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
+                if (this.ax >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter // Paper
                     this.die();
                 }
             }
-- 
2.12.0.windows.1