From 0000000000000000000000000000000000000000 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 397995fe4c360d837282535b9b7aaf7f3d93f85f..4c4385d3d20556a2695f69c95d6b3cff087d26d9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -271,4 +271,19 @@ public class PaperWorldConfig { private void nonPlayerEntitiesOnScoreboards() { nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); } + + public int nonPlayerArrowDespawnRate = -1; + public int creativeArrowDespawnRate = -1; + private void nonPlayerArrowDespawnRate() { + nonPlayerArrowDespawnRate = getInt("non-player-arrow-despawn-rate", -1); + if (nonPlayerArrowDespawnRate == -1) { + nonPlayerArrowDespawnRate = spigotConfig.arrowDespawnRate; + } + creativeArrowDespawnRate = getInt("creative-arrow-despawn-rate", -1); + if (creativeArrowDespawnRate == -1) { + creativeArrowDespawnRate = spigotConfig.arrowDespawnRate; + } + log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate); + log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); + } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java index 27c31a9e926f919c7edc8fc0cdd7fba70616d60c..046082ab7deb21574d9471b78a39a4a6bb296c2f 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -311,7 +311,7 @@ public abstract class AbstractArrow extends Projectile { protected void tickDespawn() { ++this.life; - if (this.life >= ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)) { // Spigot + if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig.creativeArrowDespawnRate : (pickup == Pickup.DISALLOWED ? level.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? this.discard(); }