diff --git a/lib/plugins/anvil.js b/lib/plugins/anvil.js index 9675a3a419..8a9fc3f644 100644 --- a/lib/plugins/anvil.js +++ b/lib/plugins/anvil.js @@ -6,6 +6,8 @@ module.exports = inject function inject (bot) { const Item = require('prismarine-item')(bot.registry) + // The anvil custom name limit was raised from 35 to 50 characters in 1.17 + const maxNameLength = bot.supportFeature('anvilNameLengthIsFifty') ? 50 : 35 const matchWindowType = window => /minecraft:(?:chipped_|damaged_)?anvil/.test(window.type) @@ -43,7 +45,7 @@ function inject (bot) { } async function combine (itemOne, itemTwo, name) { - if (name?.length > 35) err('Name is too long.') + if (name?.length > maxNameLength) err('Name is too long.') if (bot.supportFeature('useMCItemName')) { bot._client.registerChannel('MC|ItemName', 'string') } @@ -70,7 +72,7 @@ function inject (bot) { } async function rename (item, name) { - if (name?.length > 35) err('Name is too long.') + if (name?.length > maxNameLength) err('Name is too long.') if (bot.supportFeature('useMCItemName')) { bot._client.registerChannel('MC|ItemName', 'string') }