Item Despawn Rate

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2013-09-22 19:10:53 +10:00
parent 19bfb10583
commit 54a84c6c79
2 changed files with 20 additions and 2 deletions

View File

@ -94,11 +94,13 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level().isClientSide) {
@@ -202,7 +215,13 @@
@@ -201,8 +214,14 @@
}
}
if (!this.level().isClientSide && this.age >= 6000) {
- if (!this.level().isClientSide && this.age >= 6000) {
- this.discard();
+ if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ // CraftBukkit start - fire ItemDespawnEvent
+ if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
@ -233,3 +235,12 @@
itemstack.setCount(i);
}
@@ -492,7 +564,7 @@
public void makeFakeItem() {
this.setNeverPickUp();
- this.age = 5999;
+ this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
}
public static float getSpin(float f, float f1) {

View File

@ -187,4 +187,11 @@ public class SpigotWorldConfig
this.mobSpawnRange = (byte) this.getInt( "mob-spawn-range", 6 );
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
}
public int itemDespawnRate;
private void itemDespawnRate()
{
this.itemDespawnRate = this.getInt( "item-despawn-rate", 6000 );
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
}
}