Adds Contract annotation to CompatibleMaterial#getMaterial

This commit is contained in:
Christian Koop 2022-08-21 20:39:50 +02:00
parent 76b3dc6682
commit 72c96bc09a
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Contract;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -1542,6 +1543,7 @@ public enum CompatibleMaterial {
*
* @return LegacyMaterial or null if none found
*/
@Contract("_, !null -> !null")
public static CompatibleMaterial getMaterial(String name, CompatibleMaterial def) {
return name == null ? def : lookupMap.getOrDefault(name.toUpperCase(), def);
}