From 2b5b8fd3777fea8ced8a2f4b1f4b9911183c8fa9 Mon Sep 17 00:00:00 2001 From: Aikar 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 55253d6..f528fd1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -274,4 +274,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 ccbf47e..b7ac5f7 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -149,7 +149,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { if (block == this.aw && i == this.ax) { ++this.ay; - if (this.ay >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter + if (this.ay >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter // Paper this.die(); } } else { -- 2.9.0