From 4b6a0ee05df10f12efc8ae20b698b2811e609d78 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 3 Nov 2021 11:32:31 +0000 Subject: [PATCH] Added option to blacklist inventory types from async display, fixing anvils --- .../com/willfp/eco/spigot/display/PacketWindowItems.kt | 5 +++++ eco-core/core-plugin/src/main/resources/config.yml | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt index 467662a2..dd1e6a0b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt @@ -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 } diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 5dc685c8..e5b7032e 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -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: