mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-01 15:13:26 +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();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user