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
|
2021-01-11 02:44:06 +01:00
|
|
|
index 3ac2ac3db9b1c271b3c21930bb13716669ff64d3..3c78d3234054ce2dc46ef77decb6adb0cbd10620 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
|
2021-01-11 02:44:06 +01:00
|
|
|
@@ -215,4 +215,19 @@ public class PaperWorldConfig {
|
2020-06-28 10:35:41 +02:00
|
|
|
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-11-12 05:58:42 +01:00
|
|
|
index 1bd522f84f034552e4a82fc07f93ce32c5532f81..2a86d4b8af5e436e82e003f50c1929702af700c4 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();
|
|
|
|
}
|
|
|
|
|