Added option to toggle displayed recipes

This commit is contained in:
Auxilor
2022-05-28 13:59:03 +01:00
parent 999c831dd7
commit 852d40372d
4 changed files with 87 additions and 69 deletions

View File

@@ -15,6 +15,10 @@ class PacketAutoRecipe(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packet
player: Player,
event: PacketEvent
) {
if (!this.getPlugin().configYml.getBool("displayed-recipes")) {
return
}
if (!EcoPlugin.getPluginNames()
.contains(packet.minecraftKeys.values[0].fullKey.split(":".toRegex()).toTypedArray()[0])
) {
@@ -28,4 +32,4 @@ class PacketAutoRecipe(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packet
newAutoRecipe.minecraftKeys.write(0, packet.minecraftKeys.read(0))
ProtocolLibrary.getProtocolManager().sendServerPacket(player, newAutoRecipe)
}
}
}

View File

@@ -72,3 +72,11 @@ use-safer-namespacedkey-creation: false
# If the stack traces of extensions that failed to load should be logged. Disabled by
# default to prevent users from reporting bugs. Enable if you're a developer.
log-full-extension-errors: false
# To make the custom crafting system work better for players, players are also sent an
# additional recipe containing the displayed items as ingredients. However, with a large
# number of recipes, this can create PacketTooLargeExceptions. If you have this exception,
# disable this option. Bear in mind that this means the auto-craft preview will fail to
# render items nicely, which may degrade the user experience on your server. If you use
# a custom crafting table, though, this won't affect anything, and you should disable the option.
displayed-recipes: true