Check for SHORT_GRASS before using it. #2283

This commit is contained in:
tastybento 2024-01-23 12:50:42 -08:00
parent 13bd1bb8f3
commit 787424b999

View File

@ -8,6 +8,7 @@ import java.util.Map;
import org.bukkit.Material;
import com.google.common.base.Enums;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
@ -34,7 +35,9 @@ public final class MaterialTypeAdapter extends TypeAdapter<Material>
Arrays.stream(Material.values()).forEach(mat -> this.materialMap.put(mat.name(), mat));
// Put in renamed material values.
this.materialMap.put("GRASS", Material.SHORT_GRASS);
if (Enums.getIfPresent(Material.class, "SHORT_GRASS").isPresent()) {
this.materialMap.put("GRASS", Material.SHORT_GRASS);
}
}
@Override