19
19
20
20
package net .clementraynaud .skoice ;
21
21
22
+ import net .clementraynaud .skoice .analytics .AnalyticManager ;
22
23
import net .clementraynaud .skoice .api .SkoiceAPI ;
23
24
import net .clementraynaud .skoice .bot .Bot ;
24
25
import net .clementraynaud .skoice .commands .skoice .SkoiceCommand ;
33
34
import net .clementraynaud .skoice .storage .config .OutdatedConfig ;
34
35
import net .clementraynaud .skoice .system .ListenerManager ;
35
36
import net .clementraynaud .skoice .tasks .InterruptSystemTask ;
36
- import net .clementraynaud .skoice .util .ChartUtil ;
37
37
import net .kyori .adventure .platform .bukkit .BukkitAudiences ;
38
- import org .bstats .bukkit .Metrics ;
39
- import org .bstats .charts .SimplePie ;
40
38
import org .bukkit .GameMode ;
41
39
import org .bukkit .plugin .java .JavaPlugin ;
42
40
43
41
import java .time .Duration ;
44
- import java .util .EnumSet ;
45
42
46
43
public class Skoice extends JavaPlugin {
47
44
48
45
private static final String OUTDATED_MINECRAFT_SERVER_ERROR_MESSAGE = "Skoice only supports Minecraft 1.8 or later. Please update your Minecraft server to use the proximity voice chat." ;
49
- private static final int BSTATS_SERVICE_ID = 11380 ;
50
46
private static SkoiceAPI api ;
51
47
private MinecraftLang lang ;
52
48
private ConfigYamlFile configYamlFile ;
@@ -57,6 +53,7 @@ public class Skoice extends JavaPlugin {
57
53
private Bot bot ;
58
54
private BukkitAudiences adventure ;
59
55
private HookManager hookManager ;
56
+ private AnalyticManager analyticManager ;
60
57
61
58
public static SkoiceAPI api () {
62
59
return Skoice .api ;
@@ -93,7 +90,8 @@ public void onEnable() {
93
90
new SkoiceCommand (this ).init ();
94
91
this .hookManager = new HookManager (this );
95
92
this .hookManager .initialize ();
96
- this .addCustomCharts ();
93
+ this .analyticManager = new AnalyticManager (this );
94
+ this .analyticManager .initialize ();
97
95
Updater updater = new Updater (this , this .getFile ().getAbsolutePath ());
98
96
updater .runUpdaterTaskTimer ();
99
97
}
@@ -134,56 +132,6 @@ private boolean isMinecraftServerCompatible() {
134
132
return true ;
135
133
}
136
134
137
- private void addCustomCharts () {
138
- Metrics metrics = new Metrics (this , Skoice .BSTATS_SERVICE_ID );
139
-
140
- this .getSharedConfigFields ().forEach (field ->
141
- metrics .addCustomChart (new SimplePie (field .toCamelCase (), () ->
142
- this .configYamlFile .getString (field .toString ())
143
- ))
144
- );
145
-
146
- this .getSharedIntConfigFields ().forEach (field ->
147
- metrics .addCustomChart (ChartUtil .createDrilldownPie (field .toCamelCase (),
148
- this .configYamlFile .getInt (field .toString ()), 0 , 10 , 11 )
149
- )
150
- );
151
-
152
- int linkedUsers = this .linksYamlFile .getLinks ().size ();
153
- metrics .addCustomChart (ChartUtil .createDrilldownPie ("linkedUsers" , linkedUsers , 0 , 10 , 11 ));
154
-
155
- metrics .addCustomChart (new SimplePie ("botStatus" , () -> this .bot .getStatus ().toString ()));
156
- }
157
-
158
- private EnumSet <ConfigField > getSharedConfigFields () {
159
- return EnumSet .of (
160
- ConfigField .LANG ,
161
- ConfigField .LOGIN_NOTIFICATION ,
162
- ConfigField .CONNECTING_ALERT ,
163
- ConfigField .DISCONNECTING_ALERT ,
164
- ConfigField .TOOLTIPS ,
165
- ConfigField .PLAYERS_ON_DEATH_SCREEN_INCLUDED ,
166
- ConfigField .SPECTATORS_INCLUDED ,
167
- ConfigField .SEPARATED_TEAMS ,
168
- ConfigField .TEXT_CHAT ,
169
- ConfigField .CHANNEL_VISIBILITY ,
170
- ConfigField .DISCORDSRV_SYNCHRONIZATION ,
171
- ConfigField .ESSENTIALSX_SYNCHRONIZATION ,
172
- ConfigField .RELEASE_CHANNEL
173
- );
174
- }
175
-
176
- private EnumSet <ConfigField > getSharedIntConfigFields () {
177
- EnumSet <ConfigField > fields = EnumSet .noneOf (ConfigField .class );
178
- if (this .configYamlFile .contains (ConfigField .HORIZONTAL_RADIUS .toString ())) {
179
- fields .add (ConfigField .HORIZONTAL_RADIUS );
180
- }
181
- if (this .configYamlFile .contains (ConfigField .VERTICAL_RADIUS .toString ())) {
182
- fields .add (ConfigField .VERTICAL_RADIUS );
183
- }
184
- return fields ;
185
- }
186
-
187
135
public MinecraftLang getLang () {
188
136
return this .lang ;
189
137
}
@@ -215,4 +163,8 @@ public Bot getBot() {
215
163
public HookManager getHookManager () {
216
164
return this .hookManager ;
217
165
}
166
+
167
+ public AnalyticManager getAnalyticManager () {
168
+ return this .analyticManager ;
169
+ }
218
170
}
0 commit comments