@@ -274,7 +274,7 @@ open class ItemBuilder {
274
274
// 无法破坏
275
275
try {
276
276
itemMeta.isUnbreakable = isUnbreakable
277
- } catch (_: NoSuchMethodError ) {
277
+ } catch (_: Throwable ) {
278
278
try {
279
279
itemMeta.invokeMethod<Any >(" spigot" )!! .invokeMethod<Any >(" setUnbreakable" , isUnbreakable)
280
280
} catch (_: NoSuchMethodException ) {
@@ -285,36 +285,36 @@ open class ItemBuilder {
285
285
if (spawnType != null && itemMeta is SpawnEggMeta ) {
286
286
itemMeta.spawnedType = spawnType
287
287
}
288
- } catch (_: NoClassDefFoundError ) {
288
+ } catch (_: Throwable ) {
289
289
}
290
290
// 旗帜
291
291
try {
292
292
if (patterns.isNotEmpty() && itemMeta is BannerMeta ) {
293
293
patterns.forEach { itemMeta.addPattern(it) }
294
294
}
295
- } catch (_: NoClassDefFoundError ) {
295
+ } catch (_: Throwable ) {
296
296
}
297
297
// CustomModelData
298
298
try {
299
299
if (customModelData != - 1 ) {
300
300
itemMeta.setCustomModelData(customModelData)
301
301
}
302
- } catch (_: NoSuchMethodError ) {
302
+ } catch (_: Throwable ) {
303
303
}
304
304
// Tooltip Style
305
305
try {
306
306
itemMeta.tooltipStyle = tooltipStyle
307
- } catch (_: NoSuchMethodError ) {
307
+ } catch (_: Throwable ) {
308
308
}
309
309
// ItemModel
310
310
try {
311
311
itemMeta.itemModel = itemModel
312
- } catch (_: NoSuchMethodError ) {
312
+ } catch (_: Throwable ) {
313
313
}
314
314
// Hide Tooltip
315
315
try {
316
316
itemMeta.isHideTooltip = isHideTooltip
317
- } catch (_: NoSuchMethodError ) {
317
+ } catch (_: Throwable ) {
318
318
}
319
319
// 唯一化
320
320
try {
@@ -328,7 +328,7 @@ open class ItemBuilder {
328
328
XAttribute .ATTACK_SPEED .get()?.let { itemMeta.addAttributeModifier(it, modifier) }
329
329
itemMeta.addItemFlags(ItemFlag .HIDE_ATTRIBUTES )
330
330
}
331
- } catch (_: NoSuchMethodError ) {
331
+ } catch (_: Throwable ) {
332
332
}
333
333
334
334
// 返回
@@ -394,7 +394,7 @@ open class ItemBuilder {
394
394
// 无法破坏
395
395
try {
396
396
isUnbreakable = itemMeta.isUnbreakable
397
- } catch (_: NoSuchMethodError ) {
397
+ } catch (_: Throwable ) {
398
398
try {
399
399
isUnbreakable = itemMeta.invokeMethod<Any >(" spigot" )!! .invokeMethod<Boolean >(" isUnbreakable" ) ? : false
400
400
} catch (_: NoSuchMethodException ) {
@@ -405,38 +405,34 @@ open class ItemBuilder {
405
405
if (itemMeta is SpawnEggMeta && itemMeta.spawnedType != null ) {
406
406
spawnType = itemMeta.spawnedType
407
407
}
408
- } catch (_: NoSuchMethodError ) {
409
- } catch (_: UnsupportedOperationException ) {
408
+ } catch (_: Throwable ) {
410
409
}
411
410
// 旗帜
412
411
try {
413
412
if (itemMeta is BannerMeta && itemMeta.patterns.isNotEmpty()) {
414
413
patterns + = itemMeta.patterns
415
414
}
416
- } catch (_: NoClassDefFoundError ) {
415
+ } catch (_: Throwable ) {
417
416
}
418
417
// CustomModelData
419
418
try {
420
- // 1.21.5+ 必须判断 hasCustomModelData() 否则报错
421
- if (itemMeta.hasCustomModelData()) {
422
- customModelData = itemMeta.customModelData
423
- }
424
- } catch (_: NoSuchMethodError ) {
419
+ customModelData = itemMeta.customModelData
420
+ } catch (_: Throwable ) {
425
421
}
426
422
// Tooltip Style
427
423
try {
428
424
tooltipStyle = itemMeta.tooltipStyle
429
- } catch (_: NoSuchMethodError ) {
425
+ } catch (_: Throwable ) {
430
426
}
431
427
// ItemModel
432
428
try {
433
429
itemModel = itemMeta.itemModel
434
- } catch (_: NoSuchMethodError ) {
430
+ } catch (_: Throwable ) {
435
431
}
436
432
// Hide Tooltip
437
433
try {
438
434
isHideTooltip = itemMeta.isHideTooltip
439
- } catch (_: NoSuchMethodError ) {
435
+ } catch (_: Throwable ) {
440
436
}
441
437
}
442
438
}
0 commit comments