DespawnScheduler

class DespawnScheduler(plugin: PaperMcDespawnedItems, random: Random = Random.Default)

Bounds the automatic despawn pipeline so a flood of despawning items can't storm the server, and shares that bounded budget fairly between players.

Two independent layers:

  • Server budget (performance:) — at most max-per-tick new relocations start each tick and never more than max-concurrent run at once. This is what stops the server from being overwhelmed.

  • Per-user budget (throttle:) — how much of that server budget any one player may take, via io.fairyfox.papermc.despawneditems.throttle.ThrottleManager. This is what stops one player from starving everyone else.

The void.chance roll happens here too, at enqueue time rather than per relocation attempt: an item's fate should be decided once, not re-rolled at every candidate location.

Constructors

Link copied to clipboard
constructor(plugin: PaperMcDespawnedItems, random: Random = Random.Default)

Properties

Link copied to clipboard

Items dropped because their owner was over quota (diagnostics + tests).

Link copied to clipboard
val queued: Int

Number of items waiting to be relocated.

Link copied to clipboard

Items voided by the void.chance roll since enable (diagnostics + tests).

Functions

Link copied to clipboard
fun enqueue(item: ItemStack)

Queues item for relocation with no attributed owner.

fun enqueue(item: ItemStack, actor: UUID?)

Queues item for relocation on behalf of actor, honouring the queue cap, the drop policy, and the configured void chance.

Link copied to clipboard
fun start()
Link copied to clipboard
fun stop()