Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6476

Spigot 1.16.5 still uses mcstats =)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • None
    • 3083-Spigot-9fb885e-9c7acb6 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
    • Yes

      McStats was abandoned long ago.
      mcstats.org and mcstats.spigotmc.org have the same ip 198.27.66.94 and do not work (no ping).
      May be it's time to disable mcstats already or atleast set 'opt-out: true' when plugins/PluginMetrics/config.yml is created?

      I am not sure if mcstats.spigotmc.org will have its own ip soon, but in any case class org.spigotmc.Metrics saves config to plugins/PluginMetrics/config.yml. And other old plugins (abandoned plugins that still work great) also use this config file with their mcstats metrics. So, the server administrators will set the option ''opt-out: true' to prevent running mcstats statistics manually and also disable collecting spigot statistics. Why will they do it? Because:
      1, http://mcstats.org/ does not work anyway and there is no point to run metrics again and again for their plugins.
      2. Other spigot based servers (paper, etc) show error while stopping the server. This happens because the standard mcstats class runs the job via runTaskTimerAsynchronously and it delays up to 20 seconds while connecting to mcstats.org. But the server main thread does not wait for async tasks to finish and show the error on stopping the server like:
      Nag author: 'some author' of 'some plugin' about the following: This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies.

      I suggest you (if you are really going to use your own mcstats.spigotmc.org with a different ip from mcstats.org) using your own config.yml (not plugins/PluginMetrics/config.yml) or the admins will disable it manually and you will not be able to collect spigot statistics to your own url. Or just disable mcstats altogether.

      I do not understand where source code on stash is located (I found only patches), therefore I will post fragments of decompiled code here to show where and what to do.

      Method 1. set 'opt-out: true'
      org.spigotmc.Metrics:

      public class Metrics {
          ...
          public Metrics() throws IOException {
              this.configuration = YamlConfiguration.loadConfiguration(this.configurationFile);
              this.configuration.addDefault("opt-out", true); // <=== HERE!
              this.configuration.addDefault("guid", UUID.randomUUID().toString());
              this.configuration.addDefault("debug", false);
              if (this.configuration.get("guid", (Object)null) == null) {
                  this.configuration.options().header("http://mcstats.org").copyDefaults(true);
                  this.configuration.save(this.configurationFile);
              }
      
              this.guid = this.configuration.getString("guid");
              this.debug = this.configuration.getBoolean("debug", false);
          }
      

       

      Method 2. Remove completely

      org.spigotmc.SpigotConfig:

      public class SpigotConfig {
          ...
      //    private static Metrics metrics; <=== REMOVE HERE
          ...
          public static void registerCommands() {
              Iterator var1 = commands.entrySet().iterator();
      
              while(var1.hasNext()) {
                  Entry<String, Command> entry = (Entry)var1.next();
                  MinecraftServer.getServer().server.getCommandMap().register((String)entry.getKey(), "Spigot", (Command)entry.getValue());
              }
      
      // AND HERE:
      //        if (metrics == null) {
      //            try {
      //                metrics = new Metrics();
      //                metrics.start();
      //            } catch (IOException var2) {
      //                Bukkit.getServer().getLogger().log(Level.SEVERE, "Could not start metrics service", var2);
      //            }
      //        }
      
          }
      

      + remove org.spigotmc.Metrics
       

      Method 3. Also you can use bStats instead mcstats 

            Unassigned Unassigned
            serjproch Serj
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: