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

Commands data report creates a server instance for no reason

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13-pre10, Minecraft 1.13, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 1.13.1-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w43b, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w04b, Minecraft 19w05a
    • Fix Version/s: None
    • Confirmation Status:
      Unconfirmed
    • Category:
      (Unassigned)

      Description

      The commands data report creates a new server instance (along with setting up a ton of other stuff) to create a command tree instance:

      (using forge's MCPConfig with 18w22c mappings; the same code is present in 1.13-pre2 though)

          public void func_200398_a(DirectoryCache p_200398_1_) throws IOException
          {
              YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
              MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
              GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
              File file1 = new File(this.field_200400_a.func_200391_b().toFile(), "tmp");
              PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.USER_CACHE_FILE.getName()));
              MinecraftServer minecraftserver = new DedicatedServer(file1, DataFixesManager.createFixer(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache);
              minecraftserver.func_195571_aL().func_200378_a(this.field_200400_a.func_200391_b().resolve("reports/commands.json").toFile());
          }
      

      This takes several seconds, while it prepares all the authentication stuff and then the server. However, it could just be replaced with:

          public void func_200398_a(DirectoryCache p_200398_1_) throws IOException
          {
              new Commands(true).func_200378_a(this.field_200400_a.func_200391_b().resolve("reports/commands.json").toFile());
          }
      

      which is much faster and simpler. This produces the exact same report (I have tested it), and still detects the ambiguous /teleport commands.


      This also causes the dedicated server classes to be included in the client JAR, since they are still referenced.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pokechu22 [Mod] Pokechu22
              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: