Skip to content

Commit 433f0c3

Browse files
committed
removed try and catch as it no longer needed
1 parent 3ec818d commit 433f0c3

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ public static ItemStack applyToItem(@Nullable final ItemStack item, final boolea
6969
item.setItemMeta(meta);
7070
return item;
7171
}
72-
73-
try {
74-
return NMS_NBT_BRIDGE.applyUnbreakableTag(item, "Unbreakable", unbreakable);
75-
} catch (InvocationTargetException | IllegalAccessException | InstantiationException t) {
76-
logger.logError(t, () -> "Failed to apply legacy unbreakable");
77-
return item;
78-
}
72+
return NMS_NBT_BRIDGE.applyUnbreakableTag(item, "Unbreakable", unbreakable);
7973
}
8074

8175
/**
@@ -94,12 +88,7 @@ public static boolean isUnbreakable(@Nullable final ItemStack item) {
9488
final ItemMeta itemMeta = item.getItemMeta();
9589
return itemMeta != null && itemMeta.isUnbreakable();
9690
} else {
97-
try {
98-
return NMS_NBT_BRIDGE.hasBooleanTag(item, "Unbreakable");
99-
} catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
100-
logger.logError(e, () -> "Failed to invoke the item to check if it is unbreakable.");
101-
return false;
102-
}
91+
return NMS_NBT_BRIDGE.hasBooleanTag(item, "Unbreakable");
10392
}
10493
}
10594

@@ -173,10 +162,10 @@ public boolean isModernSupported() {
173162
*/
174163
public ItemStack applyUnbreakableTag(@Nonnull final ItemStack item, @Nonnull final String key, final boolean unbreakable) {
175164
NbtData nms = new NbtData(item);
176-
if(!nms.isReflectionReady()) return item;
165+
if (!nms.isReflectionReady()) return item;
177166

178167
CompoundTag compound = nms.getOrCreateCompound();
179-
compound.setBoolean(key,unbreakable);
168+
compound.setBoolean(key, unbreakable);
180169
return nms.apply(compound);
181170
}
182171

@@ -190,9 +179,9 @@ public ItemStack applyUnbreakableTag(@Nonnull final ItemStack item, @Nonnull fin
190179
*/
191180
public boolean hasBooleanTag(@Nonnull final ItemStack item, @Nonnull String key) {
192181
NbtData nms = new NbtData(item);
193-
if(!nms.isReflectionReady()) return false;
182+
if (!nms.isReflectionReady()) return false;
194183

195-
final CompoundTag compound = nms.getCompound();
184+
final CompoundTag compound = nms.getCompound();
196185
if (compound == null) {
197186
return false;
198187
}

0 commit comments

Comments
 (0)