From 72c96bc09a57c4fc6003c94e0304d6b7c14e662f Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Sun, 21 Aug 2022 20:39:50 +0200 Subject: [PATCH] Adds Contract annotation to CompatibleMaterial#getMaterial --- .../java/com/songoda/core/compatibility/CompatibleMaterial.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java index f56914ba..37f37989 100644 --- a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java +++ b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java @@ -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); }