1.17.1 SkullMeta#setDisplayName overriden by default

Discussion in 'Spigot Plugin Development' started by abstractionAlpha, Oct 17, 2021.

  1. Hi, all. I am trying to implement the following code in a GUI:
    Code (Java):
    ItemStack isHunters = new ItemStack(Material.PLAYER_HEAD, 1);
    SkullMeta smHunters = (SkullMeta) isHunters.getItemMeta();
    if (hunters.size() != 0) {
    lore = new ArrayList<String>();
    lore.add("Open Hunters Window");
    Code (Java):
    inv.setItem(ROW_LENGTH + 4, isHunters);
    where inv is a 3-row chest GUI and the only player in the hunters ArrayList is me (abstractionAlpha). The other objects in the GUI are fine, but the isHunters item says "abstractionAlpha's Head", even though I expected it to be "Hunters". (Photo attached.)

    Am I doing something wrong? My other skull (on the left) was successfully renamed with the same implementation, so I would expect this one to work as well... Is the handling different for owned heads? If this should be working, then I'll file a bug report.

  2. Here's the code for that Steve head on the left, which is successfully renamed and has its appropriate lore.

    Code (Java):
    ItemStack isRunners = new ItemStack(Material.PLAYER_HEAD, 1);
    SkullMeta smRunners = (SkullMeta) isRunners.getItemMeta();
    if (runners.size() != 0) {
    lore = new ArrayList<String>();
    lore.add("Open Runners Window");
  3. Bump since it's been a couple of days.

    Are there any standards for how often to bump? I don't want to be rude, but I also want help...
  4. You can bump once every 24h.

    If both code are the same and one works but not the other maybe there is something to check somewhere else. Is this code inside a for loop or something?
  5. Alright, thank you.

    This code isn't in a loop, no. The two skulls are actually in the exact same scope.
  6. Later today, I'll compile this against 1.16 and see if that fixes it. Might just be a 1.17 issue, or can broaden the stuff that I can search from.
  7. Sorry, I know this isn't a good resolution, but somehow this issue resolved itself overnight. If anyone else has this problem, try just reloading your CraftBukkit/Spigot or restarting your server.