Added option to blacklist inventory types from async display, fixing anvils

This commit is contained in:
Auxilor
2021-11-03 11:32:31 +00:00
parent 89e5d8898b
commit 4b6a0ee05d
2 changed files with 11 additions and 0 deletions

View File

@@ -90,6 +90,11 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
}
private fun usingAsync(player: Player): Boolean {
if (this.getPlugin().configYml.getStrings("async-display.disable-on-types", false)
.map { it.lowercase() }.contains(player.openInventory.type.name.lowercase())) {
return false
}
if (this.getPlugin().configYml.getBool("async-display.enabled")) {
return true
}

View File

@@ -54,6 +54,12 @@ async-display:
# Log errors that occur in async processing.
log-errors: true
# The inventory types that should never be processed asynchronously.
# A list of IDs can be found here:
# https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryType.html
disable-on-types:
- 'anvil'
# If the server is running under heavy load (below a certain TPS value), enable
# async display automatically. This can prevent some server crashes under load.
emergency: