Skip to content

Commit 7b1e9b9

Browse files
committed
Clean up the new Unbreakabl class
1 parent c49d37f commit 7b1e9b9

File tree

2 files changed

+249
-102
lines changed

2 files changed

+249
-102
lines changed

Item Creator/src/main/java/org/broken/arrow/library/itemcreator/ItemCreator.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public ItemCreator(final Plugin pluginInstance, boolean turnOffLogger) {
7272

7373
this.convertItems = new ConvertToItemStack(serverVersion.getServerVersion());
7474

75+
Bukkit.getScheduler().runTaskLater(pluginInstance, () -> UnbreakableUtil.isUnbreakable(null), 1L);
7576
try {
7677
TextTranslator.getInstance();
7778
} catch (NoClassDefFoundError ignore) {
@@ -390,7 +391,7 @@ public static MapView getMapById(int id) {
390391
Method getMap = Bukkit.class.getMethod("getMap", short.class);
391392
return (MapView) getMap.invoke(null, (short) id);
392393
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
393-
throw new Validate.ValidateExceptions(e,"Could not find the method getMap");
394+
throw new Validate.ValidateExceptions(e, "Could not find the method getMap");
394395
}
395396
} else {
396397
return Bukkit.getMap(id);
@@ -452,12 +453,12 @@ private static Enchantment getEnchantment(@Nullable final NamespacedKey key, @Nu
452453
* <p>On legacy versions (1.8–1.12), this will return a new copy of the metadata.
453454
* On modern versions (1.13+), the original metadata instance is modified and returned.</p>
454455
*
455-
* @param meta the ItemMeta to modify
456+
* @param meta the ItemMeta to modify
456457
* @param unbreakable true to make the item unbreakable, false otherwise
457458
* @return the modified ItemMeta, it will be a new instance on legacy versions.
458459
*/
459460
public static ItemMeta applyUnbreakable(final ItemMeta meta, final boolean unbreakable) {
460-
return UnbreakableUtil.applyToMeta(meta,unbreakable);
461+
return UnbreakableUtil.applyToMeta(meta, unbreakable);
461462
}
462463

463464
/**
@@ -466,12 +467,12 @@ public static ItemMeta applyUnbreakable(final ItemMeta meta, final boolean unbre
466467
* <p>On legacy versions, this may create a new ItemStack copy.
467468
* On modern versions, the original ItemStack is modified.</p>
468469
*
469-
* @param item the ItemStack to modify
470+
* @param item the ItemStack to modify
470471
* @param unbreakable true to make the item unbreakable, false otherwise
471472
* @return the modified ItemStack, may be a new instance on legacy versions
472473
*/
473474
public static ItemStack applyUnbreakableToItem(final ItemStack item, final boolean unbreakable) {
474-
return UnbreakableUtil.applyToItem(item,unbreakable);
475+
return UnbreakableUtil.applyToItem(item, unbreakable);
475476
}
476477

477478
/**
@@ -484,7 +485,7 @@ public static ItemStack applyUnbreakableToItem(final ItemStack item, final boole
484485
* @return {@code true} if the item is unbreakable, {@code false} otherwise (or if the check failed on legacy versions)
485486
*/
486487
public static boolean isUnbreakable(ItemStack item) {
487-
return UnbreakableUtil. isUnbreakable(item);
488+
return UnbreakableUtil.isUnbreakable(item);
488489
}
489490

490491

0 commit comments

Comments
 (0)