Fix unbreakable only being set in certain cases

This commit is contained in:
Pim van der Loos 2022-04-04 17:38:00 +02:00
parent ca2b28e267
commit bdb005a3c8
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8

View File

@ -290,7 +290,7 @@ public class ArmoredElytraBuilder
* Whether the output armored elytra should be unbreakable. This defaults to {@link ConfigLoader#unbreakable()}
* when not overridden.
*/
private boolean isUnbreakable;
private @Nullable Boolean isUnbreakable = null;
private Builder(NBTEditor nbtEditor, DurabilityManager durabilityManager,
ConfigLoader config, ArmoredElytra plugin)
@ -309,6 +309,8 @@ public class ArmoredElytraBuilder
name = name == null ? plugin.getArmoredElytraName(newArmorTier) : name;
lore = lore == null ? plugin.getElytraLore(newArmorTier) : lore;
isUnbreakable = isUnbreakable == null ? config.unbreakable() : isUnbreakable;
final ItemStack output = nbtEditor.addArmorNBTTags(newArmoredElytra, newArmorTier,
isUnbreakable, name, lore, color);
durabilityManager.setDurability(output, durability, newArmorTier);
@ -379,7 +381,6 @@ public class ArmoredElytraBuilder
throw new IllegalArgumentException("A regular elytra cannot be combined with an armored one!");
withColor(getItemColor(newArmoredElytra, item));
unbreakable(config.unbreakable());
addEnchantments(item);