Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-157426

Command outputs which should be sorted don't get sorted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.14.4, 19w35a, 19w38b, 19w39a, 19w41a, 19w42a, 19w44a, 19w45a, 19w46a, 19w46b, 1.15 Pre-Release 2, 1.15 Pre-release 3
    • Fix Version/s: 1.15 Pre-release 4
    • Confirmation Status:
      Confirmed
    • Category:
      Commands
    • Mojang Priority:
      Important

      Description

      Steps to reproduce:

      • Run the commands
      /tag @s add a
      /tag @s add b
      /tag @s add p
      /tag @s add q
      /tag @s list
      • The feedback is
      Player has 4 tags: p, a, q, b

      but it should be ordered alphabetically

      Player has 4 tags: a, b, p, q

      Other affected commands: /scoreboard players list and /team list <team>

       

      Code analysis (official mappings)

      public static Component formatAndSortList(Collection in, Function formatter) {
          if (in.isEmpty()) {
              return new TextComponent("");
          } else if (in.size() == 1) {
              return (Component)formatter.apply(in.iterator().next());
          } else {
              ArrayList sorted = Lists.newArrayList(in);
              sorted.sort(Comparable::compareTo);
              return formatList(in, formatter);
          }
      }
      

      The method formatAndSortList in ComponentUtils ignores the sorting result.

        Attachments

          Activity

            People

            • Assignee:
              searge [Mojang] Searge (Michael Stoyke)
              Reporter:
              Zonteek Zonteek
            • Votes:
              7 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: