Commit util method

This commit is contained in:
fullwall 2023-10-09 01:05:41 +08:00
parent 58234c469c
commit 5829ffcc07

View File

@ -224,11 +224,17 @@ public class Util {
return entity instanceof LivingEntity ? ((LivingEntity) entity).getEyeLocation() : entity.getLocation(); return entity instanceof LivingEntity ? ((LivingEntity) entity).getEyeLocation() : entity.getLocation();
} }
public static Material getFallbackMaterial(String first, String second) { public static Material getFallbackMaterial(String first, String... second) {
try { try {
return Material.valueOf(first); return Material.valueOf(first);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return Material.valueOf(second); for (String s : second) {
try {
return Material.valueOf(s);
} catch (IllegalArgumentException iae) {
}
}
return null;
} }
} }