mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 20:25:19 +01:00
Commit util method
This commit is contained in:
parent
58234c469c
commit
5829ffcc07
@ -224,11 +224,17 @@ public class Util {
|
||||
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 {
|
||||
return Material.valueOf(first);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Material.valueOf(second);
|
||||
for (String s : second) {
|
||||
try {
|
||||
return Material.valueOf(s);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user