How Do I Get Title of Advancement

Discussion in 'Spigot Plugin Development' started by Ca1eb, Jan 8, 2020.

  1. So
    Code (Text):
    gets the key of an advancement but how do I get the actual title. For example the namespace for the diamonds advancement is "story/mine_diamond" but how do I get it to return "Diamonds!"?

    Also while I'm here is there anyway to detect normal advancements vs goal/challenge advancements?
    #1 Ca1eb, Jan 8, 2020
    Last edited: Jan 8, 2020
  2. For the name part:
    This is language dependent. So you need to know the clients language and then translate it.
    Maybe there is a method to translate the namespace but not sure.
  3. id guess thats client side so youd have to record them all manually and return what you want based on the namespace

    /e in newer versions, are advancements broadcasted in chats with announce-whatever enabled? if so, there may be a method depending on how the server announces that. look there.
  4. I was afraid of that
  5. You have to translate them by yourself :/ Tried this with enchantments but i had to write a function with a switch-statement and type in every single entchantment by myself :| Good luck with that (y)
  6. take a look at nms.advancementdisplay. look at the fields in that class. im willing to bet the "title" is what youre looking for, which appears to be the first ichatbasecomponent object in the class

    /e you can get the advancementdisplay from the nms advancement. cast bukkit advancement to craftadvancement, get its handle, and then get the display. theres a public getter method for the display in nms advancement
  7. Hmm okay. I've never worked with NMS before I will try to figure it out tomorrow I guess
  8. Pls post your solution if you found one :D I'm 99% sure that the notification gets translated when the players recieves the packet.. tested it.. had one german and one english client and both got the output for the language so it must be translated when the player recieves the packet. :unsure: