I'm developing a plugin that calls setMapView on a MapMeta object. I've had this code working for a very long time, and after updating to 1.20.3 it completely broke. Whenever I try to create a Map item to give to the player, it stops working, and this exception appears in the server logs:
java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "text" is null
at org.bukkit.craftbukkit.v1_20_R3.map.CraftMapView.getId(CraftMapView.java:36)
at org.bukkit.craftbukkit.v1_20_R3.inventory.CraftMetaMap.setMapView(CraftMetaMap.java:157)
And subsequent lines just point to where I called this method in my plugin.
Other info:
- I've verified that both my MapMeta and the MapView that I'm passing into it are not null
- I checked the Spigot code for CraftMapView (which is listed in the error message), and it seems like CraftMapView.getId() pulls from a field called worldMap.id, which seems to be what's null in this case. I'm not really sure how to go about fixing this.
- There doesn't seem to be any sort of workaround for this issue, other than issuing a server command along the lines of "/give @s filled_map{map:id}"