Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7535

MapMeta#setMapView(MapView) always throws an exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • This server is running CraftBukkit version 3956-Spigot-9d72885-5a7080b (MC: 1.20.3) (Implementing API version 1.20.3-R0.1-SNAPSHOT) You are running the latest version
    • Yes

      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}"

            Unassigned Unassigned
            Conure512 Conure
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: