2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-03-18 20:13:03 +01:00
|
|
|
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
|
2020-06-28 10:35:41 +02:00
|
|
|
index 04430aae52205ee167662004e45c145b9d2e8bed..d8b9d87bca6eb95c2cea91e4d8466b9792582d52 100644
|
2016-03-18 20:13:03 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-06-28 10:35:41 +02:00
|
|
|
@@ -208,4 +208,19 @@ public class PaperWorldConfig {
|
|
|
|
private void nonPlayerEntitiesOnScoreboards() {
|
|
|
|
nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false);
|
2016-03-18 20:13:03 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int nonPlayerArrowDespawnRate = -1;
|
2018-09-23 04:48:30 +02:00
|
|
|
+ public int creativeArrowDespawnRate = -1;
|
2016-03-18 20:13:03 +01:00
|
|
|
+ private void nonPlayerArrowDespawnRate() {
|
|
|
|
+ nonPlayerArrowDespawnRate = getInt("non-player-arrow-despawn-rate", -1);
|
|
|
|
+ if (nonPlayerArrowDespawnRate == -1) {
|
|
|
|
+ nonPlayerArrowDespawnRate = spigotConfig.arrowDespawnRate;
|
|
|
|
+ }
|
2018-09-23 04:48:30 +02:00
|
|
|
+ creativeArrowDespawnRate = getInt("creative-arrow-despawn-rate", -1);
|
|
|
|
+ if (creativeArrowDespawnRate == -1) {
|
|
|
|
+ creativeArrowDespawnRate = spigotConfig.arrowDespawnRate;
|
|
|
|
+ }
|
2016-03-18 20:13:03 +01:00
|
|
|
+ log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate);
|
2018-09-23 04:48:30 +02:00
|
|
|
+ log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate);
|
2016-03-18 20:13:03 +01:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 17be0b56f8eeafd1f2ee01bc3b654f7f926c837c..2fb014c2a20363c94045dd834f771cfd9baf37cd 100644
|
2016-03-18 20:13:03 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
2020-06-25 13:00:35 +02:00
|
|
|
@@ -245,7 +245,7 @@ public abstract class EntityArrow extends IProjectile {
|
2018-07-15 03:53:17 +02:00
|
|
|
|
2020-06-25 13:00:35 +02:00
|
|
|
protected void h() {
|
2018-07-15 03:53:17 +02:00
|
|
|
++this.despawnCounter;
|
2019-12-14 01:56:34 +01:00
|
|
|
- if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot
|
|
|
|
+ if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?
|
2018-07-15 03:53:17 +02:00
|
|
|
this.die();
|
|
|
|
}
|
|
|
|
|