Skip to content

Commit 120b70e

Browse files
committed
clean up the code about what i error catch
Dopes not catch all errors, only the relevant ones.
1 parent 7b1e9b9 commit 120b70e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static ItemStack applyToItem(@Nullable final ItemStack item, final boolea
7676

7777
try {
7878
return NMS_NBT_BRIDGE.applyUnbreakableTag(item, "Unbreakable", unbreakable);
79-
} catch (Throwable t) {
79+
} catch (InvocationTargetException | IllegalAccessException | InstantiationException t) {
8080
logger.logError(t, () -> "Failed to apply legacy unbreakable");
8181
return item;
8282
}
@@ -101,7 +101,7 @@ public static boolean isUnbreakable(@Nullable final ItemStack item) {
101101
if (!NMS_NBT_BRIDGE.isReflectionReady()) return false;
102102
try {
103103
return NMS_NBT_BRIDGE.hasBooleanTag(item, "Unbreakable");
104-
} catch (Throwable e) {
104+
} catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
105105
logger.logError(e, () -> "Failed to invoke the item to check if it is unbreakable.");
106106
return false;
107107
}
@@ -276,7 +276,7 @@ public void setBooleanTag(@Nonnull final Object tag, @Nonnull final String key,
276276
* @return the NBTTagCompound if exist or create new one.
277277
*/
278278
public Object getOrCreateNbtTag(@Nonnull final Object nmsItem) throws InvocationTargetException, IllegalAccessException, InstantiationException {
279-
boolean hasTag = (Boolean) hasTagMethod.invoke(nmsItem);
279+
boolean hasTag = (boolean) hasTagMethod.invoke(nmsItem);
280280
return hasTag
281281
? getTagMethod.invoke(nmsItem)
282282
: nbtTagConstructor.newInstance();

0 commit comments

Comments
 (0)