Skip to content

Commit 50cfb06

Browse files
committed
Updated logging to use bStats.
1 parent 87d26ae commit 50cfb06

File tree

2 files changed

+30
-62
lines changed

2 files changed

+30
-62
lines changed

DriveBackup/pom.xml

+11-33
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
<artifactId>maven-shade-plugin</artifactId>
2121
<version>2.3</version>
2222
<configuration>
23-
<artifactSet>
24-
</artifactSet>
2523
<relocations>
2624
<relocation>
27-
<pattern>org.mcstats</pattern>
25+
<pattern>org.bstats</pattern>
2826
<shadedPattern>ratismal.drivebackup.DriveBackup</shadedPattern>
2927
</relocation>
3028
</relocations>
@@ -48,13 +46,10 @@
4846
<id>bukkit-repo</id>
4947
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
5048
</repository>
51-
<repository>
52-
<id>Plugin Metrics</id>
53-
<url>http://repo.mcstats.org/content/repositories/public</url>
54-
<snapshots>
55-
<enabled>true</enabled>
56-
</snapshots>
57-
</repository>
49+
<repository>
50+
<id>CodeMC</id>
51+
<url>https://repo.codemc.org/repository/maven-public</url>
52+
</repository>
5853
</repositories>
5954
<dependencies>
6055
<dependency>
@@ -79,34 +74,17 @@
7974
<artifactId>commons-io</artifactId>
8075
<version>2.4</version>
8176
</dependency>
82-
<dependency>
83-
<groupId>org.mcstats.bukkit</groupId>
84-
<artifactId>metrics</artifactId>
85-
<version>R8-SNAPSHOT</version>
86-
<scope>compile</scope>
87-
</dependency>
77+
<dependency>
78+
<groupId>org.bstats</groupId>
79+
<artifactId>bstats-bukkit</artifactId>
80+
<version>1.7</version>
81+
<scope>compile</scope>
82+
</dependency>
8883
<dependency>
8984
<groupId>com.jayway.restassured</groupId>
9085
<artifactId>rest-assured</artifactId>
9186
<version>2.8.0</version>
9287
</dependency>
93-
<!--
94-
<dependency>
95-
<groupId>org.apache.httpcomponents</groupId>
96-
<artifactId>httpclient</artifactId>
97-
<version>4.3.6</version>
98-
</dependency>
99-
<dependency>
100-
<groupId>org.apache.httpcomponents</groupId>
101-
<artifactId>httpasyncclient</artifactId>
102-
<version>4.0.2</version>
103-
</dependency>
104-
<dependency>
105-
<groupId>org.apache.httpcomponents</groupId>
106-
<artifactId>httpmime</artifactId>
107-
<version>4.3.6</version>
108-
</dependency>
109-
-->
11088
<dependency>
11189
<groupId>commons-net</groupId>
11290
<artifactId>commons-net</artifactId>

DriveBackup/src/main/java/ratismal/drivebackup/DriveBackup.java

+19-29
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package ratismal.drivebackup;
22

3+
import org.bstats.bukkit.*;
34
import org.bukkit.Bukkit;
45
import org.bukkit.plugin.PluginManager;
56
import org.bukkit.plugin.java.JavaPlugin;
67
import org.bukkit.scheduler.BukkitScheduler;
78
import org.json.simple.JSONArray;
89
import org.json.simple.JSONObject;
910
import org.json.simple.JSONValue;
10-
import org.mcstats.Metrics;
1111
import ratismal.drivebackup.config.Config;
1212
import ratismal.drivebackup.handler.CommandHandler;
1313
import ratismal.drivebackup.handler.CommandTabComplete;
@@ -19,6 +19,7 @@
1919
import java.io.InputStreamReader;
2020
import java.net.URL;
2121
import java.net.URLConnection;
22+
import java.util.concurrent.Callable;
2223
import java.util.logging.Logger;
2324

2425
public class DriveBackup extends JavaPlugin {
@@ -31,8 +32,8 @@ public class DriveBackup extends JavaPlugin {
3132
private static Config pluginconfig;
3233
private static DriveBackup plugin;
3334
public Logger log = getLogger();
34-
35-
35+
36+
3637
/**
3738
* What to do when plugin is enabled (init)
3839
*/
@@ -106,39 +107,28 @@ public void run() {
106107
}
107108

108109
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>() {
114113
@Override
115-
public int getValue() {
116-
return Config.isGoogleEnabled() ? 1 : 0;
114+
public String call() throws Exception {
115+
return Config.isGoogleEnabled() ? "Enabled" : "Disabled";
117116
}
118-
});
119-
120-
enabledModes.addPlotter(new Metrics.Plotter("OneDrive") {
117+
}));
118+
119+
metrics.addCustomChart(new Metrics.SimplePie("oneDriveEnabled", new Callable<String>() {
121120
@Override
122-
public int getValue() {
123-
return Config.isOnedriveEnabled() ? 1 : 0;
121+
public String call() throws Exception {
122+
return Config.isOnedriveEnabled() ? "Enabled" : "Disabled";
124123
}
125-
});
124+
}));
126125

127-
enabledModes.addPlotter(new Metrics.Plotter("FTP") {
126+
metrics.addCustomChart(new Metrics.SimplePie("ftpEnabled", new Callable<String>() {
128127
@Override
129-
public int getValue() {
130-
return Config.isFtpEnabled() ? 1 : 0;
128+
public String call() throws Exception {
129+
return Config.isFtpEnabled() ? "Enabled" : "Disabled";
131130
}
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+
}));
142132
}
143133

144134
/**

0 commit comments

Comments
 (0)