1
1
package ratismal .drivebackup ;
2
2
3
+ import org .bstats .bukkit .*;
3
4
import org .bukkit .Bukkit ;
4
5
import org .bukkit .plugin .PluginManager ;
5
6
import org .bukkit .plugin .java .JavaPlugin ;
6
7
import org .bukkit .scheduler .BukkitScheduler ;
7
8
import org .json .simple .JSONArray ;
8
9
import org .json .simple .JSONObject ;
9
10
import org .json .simple .JSONValue ;
10
- import org .mcstats .Metrics ;
11
11
import ratismal .drivebackup .config .Config ;
12
12
import ratismal .drivebackup .handler .CommandHandler ;
13
13
import ratismal .drivebackup .handler .CommandTabComplete ;
19
19
import java .io .InputStreamReader ;
20
20
import java .net .URL ;
21
21
import java .net .URLConnection ;
22
+ import java .util .concurrent .Callable ;
22
23
import java .util .logging .Logger ;
23
24
24
25
public class DriveBackup extends JavaPlugin {
@@ -31,8 +32,8 @@ public class DriveBackup extends JavaPlugin {
31
32
private static Config pluginconfig ;
32
33
private static DriveBackup plugin ;
33
34
public Logger log = getLogger ();
34
-
35
-
35
+
36
+
36
37
/**
37
38
* What to do when plugin is enabled (init)
38
39
*/
@@ -106,39 +107,28 @@ public void run() {
106
107
}
107
108
108
109
public void initMetrics () throws IOException {
109
- Metrics metrics = new Metrics (this );
110
-
111
- Metrics .Graph enabledModes = metrics .createGraph ("Enabled Services" );
112
-
113
- enabledModes .addPlotter (new Metrics .Plotter ("Google Drive" ) {
110
+ Metrics metrics = new Metrics (this , 7537 );
111
+
112
+ metrics .addCustomChart (new Metrics .SimplePie ("googleDriveEnabled" , new Callable <String >() {
114
113
@ Override
115
- public int getValue () {
116
- return Config .isGoogleEnabled () ? 1 : 0 ;
114
+ public String call () throws Exception {
115
+ return Config .isGoogleEnabled () ? "Enabled" : "Disabled" ;
117
116
}
118
- });
119
-
120
- enabledModes . addPlotter (new Metrics .Plotter ( "OneDrive" ) {
117
+ })) ;
118
+
119
+ metrics . addCustomChart (new Metrics .SimplePie ( "oneDriveEnabled" , new Callable < String >( ) {
121
120
@ Override
122
- public int getValue () {
123
- return Config .isOnedriveEnabled () ? 1 : 0 ;
121
+ public String call () throws Exception {
122
+ return Config .isOnedriveEnabled () ? "Enabled" : "Disabled" ;
124
123
}
125
- });
124
+ })) ;
126
125
127
- enabledModes . addPlotter (new Metrics .Plotter ( "FTP" ) {
126
+ metrics . addCustomChart (new Metrics .SimplePie ( "ftpEnabled" , new Callable < String >( ) {
128
127
@ Override
129
- public int getValue () {
130
- return Config .isFtpEnabled () ? 1 : 0 ;
128
+ public String call () throws Exception {
129
+ return Config .isFtpEnabled () ? "Enabled" : "Disabled" ;
131
130
}
132
- });
133
-
134
- enabledModes .addPlotter (new Metrics .Plotter ("None" ) {
135
- @ Override
136
- public int getValue () {
137
- return Config .isOnedriveEnabled () || Config .isGoogleEnabled () || Config .isFtpEnabled () ? 0 : 1 ;
138
- }
139
- });
140
-
141
- metrics .start ();
131
+ }));
142
132
}
143
133
144
134
/**
0 commit comments