1.15.2 Bukkit.creteInventory() with JSON title

Discussion in 'Spigot Plugin Development' started by Abit, Feb 21, 2020.

  1. Is there a way
    Code (Text):
    Bukkit.creteInventory()
    with JSON title? the creteInventory takes string and displays it as such.

    When using this code:
    Code (Text):
        NBTTagCompound display = compound.getCompound("display");
        if(display != null)
        {
            title = display.getString("Name");
        }
    it gives me
    Code (Text):
    {"text":"Text"}
    which is displayed in the title.

    Looking at Open Window packet, it has Chat as title (which is JSON) but I could not find function for it.
     
  2. Why do you want to do a title in JSON when you can use the symbol: § for chat colors?
     
  3. or the ChatColor enum, which is less prone to encoding issues on other operating systems, such as this
    caf896fe4b9c95199c7bd7d5e1bbf0f3c4724a47.png
     
    #3 Escad, Feb 21, 2020
    Last edited: Feb 21, 2020
  4. Code (Text):
    {"translate":"gui.test.title"}