@@ -427,17 +427,24 @@ public String queryMaterial(final Material material, final short durability, fin
427
427
matKey = "block.minecraft." + material .name ().toLowerCase ();
428
428
} else {
429
429
try {
430
- final Method m = craftMagicNumbers .getDeclaredMethod ("getItem" , material .getClass ());
431
- m .setAccessible (true );
432
- final Object item = m .invoke (craftMagicNumbers , material );
430
+ final Method itemMethod = craftMagicNumbers .getDeclaredMethod ("getItem" , material .getClass ());
431
+ itemMethod .setAccessible (true );
432
+ final Object item = itemMethod .invoke (craftMagicNumbers , material );
433
433
if (item == null ) {
434
434
throw new IllegalArgumentException (material .name () + " material could not be queried!" );
435
435
}
436
- matKey = (String ) resolveMethod (itemClazz , "getDescriptionId" , "a" , "getName" , "j" , "l" ).invoke (item );
436
+ final Method keyMethod = resolveMethod (itemClazz , "getDescriptionId" , "a" , "getName" , "j" , "l" );
437
+ if (keyMethod == null ) {
438
+ throw new IllegalArgumentException ("Could not get description ID for " + itemClazz .getName ());
439
+ }
440
+ matKey = (String ) keyMethod .invoke (item );
437
441
if (meta instanceof PotionMeta ) {
438
442
matKey += ".effect." + ((PotionMeta )meta ).getBasePotionData ().getType ().name ().toLowerCase ()
439
- .replace ("regen" , "regeneration" ). replace ( " speed" , "swiftness" ).replace ("jump" , "leaping" )
443
+ .replace ("speed" , "swiftness" ).replace ("jump" , "leaping" )
440
444
.replace ("instant_heal" , "healing" ).replace ("instant_damage" , "harming" );
445
+ if (!matKey .contains ("regeneration" )) {
446
+ matKey = matKey .replace ("regen" , "regeneration" );
447
+ }
441
448
}
442
449
} catch (final Exception ex ) {
443
450
throw new IllegalArgumentException ("[LocaleLib] Unable to query Material: " + material .name (), ex );
0 commit comments