spigot/CraftBukkit-Patches/0012-Item-Despawn-Rate.patch
2019-01-05 16:21:07 +11:00

46 lines
1.7 KiB
Diff

From 7a0f426b0bb2990e9439d85a112846f4f03de285 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 22 Sep 2013 19:10:53 +1000
Subject: [PATCH] Item Despawn Rate
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 0b03afd8c..d84c4c003 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -126,7 +126,7 @@ public class EntityItem extends Entity {
}
}
- if (!this.world.isClientSide && this.age >= 6000) {
+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -398,6 +398,6 @@ public class EntityItem extends Entity {
public void t() {
this.p();
- this.age = 5999;
+ this.age = world.spigotConfig.itemDespawnRate - 1; // Spigot
}
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index bcf5d1653..a43131f8b 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -139,4 +139,11 @@ public class SpigotWorldConfig
mobSpawnRange = (byte) getInt( "mob-spawn-range", 6 );
log( "Mob Spawn Range: " + mobSpawnRange );
}
+
+ public int itemDespawnRate;
+ private void itemDespawnRate()
+ {
+ itemDespawnRate = getInt( "item-despawn-rate", 6000 );
+ log( "Item Despawn Rate: " + itemDespawnRate );
+ }
}
--
2.19.1