Material.values() causes legacy data init

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • CraftBukkit version git-Spigot-800b93f-a81f6ed (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
    • Yes

      The following code triggers legacy data to be loaded, even though the plugin has its api version set (the values don't actually include any legacy materials, but the data is still being loaded)

      package eu.kennytv.test;
      
      import org.bukkit.Bukkit;
      import org.bukkit.Material;
      import org.bukkit.command.Command;
      import org.bukkit.command.CommandSender;
      import org.bukkit.plugin.java.JavaPlugin;
      
      public final class TestPlugin extends JavaPlugin {
      
          @Override
          public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
              for (final Material value : Material.values()) {
                  if (value.name().contains("LEGACY")) {
                      Bukkit.broadcastMessage("LEGACY! " + value); # never triggered, but CraftLegacy is still initialized with the values call
                  }
              }
              return true;
          }
      }
      

       

            Assignee:
            Unassigned
            Reporter:
            Nassim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: