@@ -32,6 +32,7 @@ public abstract class AbstractItemBuilder<S> implements ItemProvider {
3232 protected int amount = 1 ;
3333 protected int damage ;
3434 protected int customModelData ;
35+ protected Boolean unbreakable ;
3536 protected ComponentWrapper displayName ;
3637 protected List <ComponentWrapper > lore ;
3738 protected List <ItemFlag > itemFlags ;
@@ -116,6 +117,10 @@ public AbstractItemBuilder(@NotNull ItemStack base) {
116117 if (customModelData != 0 )
117118 itemMeta .setCustomModelData (customModelData );
118119
120+ // unbreakable
121+ if (unbreakable != null )
122+ itemMeta .setUnbreakable (unbreakable );
123+
119124 // enchantments
120125 if (enchantments != null ) {
121126 if (base != null )
@@ -201,6 +206,16 @@ public int getCustomModelData() {
201206 return (S ) this ;
202207 }
203208
209+ public @ Nullable Boolean isUnbreakable () {
210+ return unbreakable ;
211+ }
212+
213+ @ Contract ("_ -> this" )
214+ public @ NotNull S setUnbreakable (boolean unbreakable ) {
215+ this .unbreakable = unbreakable ;
216+ return (S ) this ;
217+ }
218+
204219 public @ Nullable ComponentWrapper getDisplayName () {
205220 return displayName ;
206221 }
@@ -229,15 +244,15 @@ public int getCustomModelData() {
229244 }
230245
231246 @ Contract ("_ -> this" )
232- public @ NotNull S setLore (List <ComponentWrapper > lore ) {
247+ public @ NotNull S setLore (@ NotNull List <@ NotNull ComponentWrapper > lore ) {
233248 this .lore = lore .stream ()
234249 .map (ComponentWrapper ::withoutPreFormatting )
235250 .collect (Collectors .toList ());
236251 return (S ) this ;
237252 }
238253
239254 @ Contract ("_ -> this" )
240- public @ NotNull S setLegacyLore (@ NotNull List <String > lore ) {
255+ public @ NotNull S setLegacyLore (@ NotNull List <@ NotNull String > lore ) {
241256 this .lore = lore .stream ()
242257 .map (line -> new BungeeComponentWrapper (TextComponent .fromLegacyText (line )).withoutPreFormatting ())
243258 .collect (Collectors .toList ());
@@ -273,6 +288,26 @@ public int getCustomModelData() {
273288
274289 return (S ) this ;
275290 }
291+
292+ @ Contract ("_ -> this" )
293+ public @ NotNull S addLoreLines (@ NotNull List <@ NotNull ComponentWrapper > lines ) {
294+ if (lore == null ) lore = new ArrayList <>();
295+
296+ for (ComponentWrapper line : lines )
297+ lore .add (line .withoutPreFormatting ());
298+
299+ return (S ) this ;
300+ }
301+
302+ @ Contract ("_ -> this" )
303+ public @ NotNull S addLegacyLoreLines (@ NotNull List <@ NotNull String > lines ) {
304+ if (lore == null ) lore = new ArrayList <>();
305+
306+ for (String line : lines )
307+ lore .add (new BungeeComponentWrapper (TextComponent .fromLegacyText (line )).withoutPreFormatting ());
308+
309+ return (S ) this ;
310+ }
276311 //</editor-fold>
277312
278313 //<editor-fold desc="item flags">
@@ -293,6 +328,12 @@ public int getCustomModelData() {
293328 return (S ) this ;
294329 }
295330
331+ @ Contract ("-> this" )
332+ public @ NotNull S addAllItemFlags () {
333+ this .itemFlags = new ArrayList <>(Arrays .asList (ItemFlag .values ()));
334+ return (S ) this ;
335+ }
336+
296337 @ Contract ("_ -> this" )
297338 public @ NotNull S removeItemFlags (@ NotNull ItemFlag ... itemFlags ) {
298339 if (this .itemFlags != null )
@@ -327,8 +368,7 @@ public int getCustomModelData() {
327368
328369 @ Contract ("_ -> this" )
329370 public @ NotNull S removeEnchantment (Enchantment enchantment ) {
330- if (enchantments == null ) enchantments = new HashMap <>();
331- enchantments .remove (enchantment );
371+ if (enchantments != null ) enchantments .remove (enchantment );
332372 return (S ) this ;
333373 }
334374
0 commit comments