78 lines
3.7 KiB
Diff
78 lines
3.7 KiB
Diff
|
From b04843c61db61e9940626f7cdb1978546ff8e601 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 4474104..351f0e8 100644
|
||
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
@@ -2,17 +2,21 @@ package com.destroystokyo.paper;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
+import net.minecraft.server.World;
|
||
|
import org.bukkit.Bukkit;
|
||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||
|
+import org.spigotmc.SpigotWorldConfig;
|
||
|
|
||
|
public class PaperWorldConfig {
|
||
|
|
||
|
private final String worldName;
|
||
|
+ private final SpigotWorldConfig spigotConfig;
|
||
|
private final YamlConfiguration config;
|
||
|
private boolean verbose;
|
||
|
|
||
|
- public PaperWorldConfig(String worldName) {
|
||
|
+ public PaperWorldConfig(String worldName, SpigotWorldConfig spigotConfig) {
|
||
|
this.worldName = worldName;
|
||
|
+ this.spigotConfig = spigotConfig;
|
||
|
this.config = PaperConfig.config;
|
||
|
init();
|
||
|
}
|
||
|
@@ -284,4 +288,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 5ccdb88..e5f1b71 100644
|
||
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||
|
@@ -144,7 +144,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||
|
|
||
|
if (block == this.au && i == this.av) {
|
||
|
++this.aw;
|
||
|
- if (this.aw >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
|
||
|
+ if (this.aw >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter
|
||
|
this.die();
|
||
|
}
|
||
|
} else {
|
||
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||
|
index d569f3b..6ed328a 100644
|
||
|
--- a/src/main/java/net/minecraft/server/World.java
|
||
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||
|
@@ -162,7 +162,7 @@ public abstract class World implements IBlockAccess {
|
||
|
|
||
|
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
||
|
- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig( worlddata.getName() ); // Paper
|
||
|
+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig( worlddata.getName(), this.spigotConfig); // Paper
|
||
|
this.generator = gen;
|
||
|
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||
|
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||
|
--
|
||
|
2.7.4
|
||
|
|