3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0084-Configurable-Non-Player-Arrow-Despawn-Rate.patch

42 Zeilen
2.0 KiB
Diff

2016-06-23 04:18:41 +02:00
From 646fe3e6b248037980db9a34ce73a5d1597787fa 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 57e1fcf..3f8a47b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -279,4 +279,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
2016-06-23 04:18:41 +02:00
index ccbf47e..b7ac5f7 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
2016-06-09 05:57:14 +02:00
@@ -149,7 +149,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
2016-06-09 05:57:14 +02:00
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 {
--
2016-06-23 04:18:41 +02:00
2.9.0