Package com.github.zathrus_writer.commandsex.helpers.Metrics

Examples of com.github.zathrus_writer.commandsex.helpers.Metrics.Graph


    // don't start metrics if the user has disabled it
    if (getConf().getBoolean("pluginMetrics")){
      try {
          metrics = new Metrics(plugin);
         
          Graph featureGraph = metrics.createGraph("Feature Statistics");
          if (loadedClasses.contains("Init_Home")){
            featureGraph.addPlotter(new Metrics.Plotter("Homes Set") {
            @Override
              public int getValue() {
              int count = 0;
              try {
                ResultSet rs = SQLManager.query_res("SELECT player_name FROM " + SQLManager.prefix + "homes");
                while (rs.next()){
                  count++;
                }
                rs.close();
              } catch (SQLException e){
                e.printStackTrace();
              }
             
              return count;
            }
          });
          }
         
          if (loadedClasses.contains("Init_Warps")){
            featureGraph.addPlotter(new Metrics.Plotter("Warps Set") {
            @Override
            public int getValue() {
              int count = 0;
              try {
                ResultSet rs = SQLManager.query_res("SELECT owner_name FROM " + SQLManager.prefix + "warps");
                while (rs.next()){
                  count++;
                }
                rs.close();
              } catch (SQLException e){
                e.printStackTrace();
              }
             
              return count;
            }
          });
          }
         
          if (loadedClasses.contains("Init_Nicknames")){
            featureGraph.addPlotter(new Metrics.Plotter("Nicknames Set") {
            @Override
            public int getValue() {
              int count = 0;
              try {
                ResultSet rs = SQLManager.query_res("SELECT player_name FROM " + SQLManager.prefix + "nicknames");
                while (rs.next()){
                  count++;
                }
                rs.close();
              } catch (SQLException e){
                e.printStackTrace();
              }
             
              return count;
            }
          });
          }
         
          if (loadedClasses.contains("Init_Nametags")){
            featureGraph.addPlotter(new Metrics.Plotter("Nametags Set") {
            @Override
            public int getValue() {
              int count = 0;
              try {
                ResultSet rs = SQLManager.query_res("SELECT player_name FROM " + SQLManager.prefix + "nametags");
                while (rs.next()){
                  count++;
                }
                rs.close();
              } catch (SQLException e){
                e.printStackTrace();
              }
             
              return count;
            }
          });
          }
         
          if (loadedClasses.contains("Init_Kits")){
            featureGraph.addPlotter(new Metrics.Plotter("Kits Set") {
            @Override
            public int getValue() {
              int count = 0;
              FileConfiguration f = CommandsEX.getConf();
              ConfigurationSection configGroups = f.getConfigurationSection("kits");
              if (configGroups != null){
                Set<String> kitGroups = configGroups.getKeys(false);

                for (String group : kitGroups) {
                  ConfigurationSection kits = f.getConfigurationSection("kits." + group);
                  Set<String> kitNames = kits.getKeys(false);
                  count = count + kitNames.size();
                }
              }
             
              return count;
            }
            });
          }

          // Add commands to Command Uses graph, these items must be present
          // when the server starts up otherwise the graph cannot be sent
          Graph commandUsesGraph = metrics.createGraph("Command Uses");
          for (final String s : loadedClasses){
            if (s.startsWith("Command_cex_")){
              String key = s.replaceAll("Command_cex_", "/");
             
              commandUsesGraph.addPlotter(new Metrics.Plotter(key) {
                @Override
                public int getValue() {
                  return (commandUses.containsKey(s) ? commandUses.get(s) : 0);
                }
              });
View Full Code Here

TOP

Related Classes of com.github.zathrus_writer.commandsex.helpers.Metrics.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.