1818 * along with BreweryX. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
1919 */
2020
21- package com .dre .brewery .integration .bstats ;
21+ package com .dre .brewery .integration .metrics . bstats ;
2222
2323import com .dre .brewery .BCauldron ;
2424import com .dre .brewery .BPlayer ;
2828import com .dre .brewery .Wakeup ;
2929import com .dre .brewery .configuration .ConfigManager ;
3030import com .dre .brewery .configuration .files .Config ;
31- import com .dre .brewery .integration .bstats .Metrics .AdvancedPie ;
32- import com .dre .brewery .integration .bstats .Metrics .DrilldownPie ;
33- import com .dre .brewery .integration .bstats .Metrics .SimplePie ;
34- import com .dre .brewery .integration .bstats .Metrics .SingleLineChart ;
31+ import com .dre .brewery .integration .metrics . bstats .BStats .AdvancedPie ;
32+ import com .dre .brewery .integration .metrics . bstats .BStats .DrilldownPie ;
33+ import com .dre .brewery .integration .metrics . bstats .BStats .SimplePie ;
34+ import com .dre .brewery .integration .metrics . bstats .BStats .SingleLineChart ;
3535import com .dre .brewery .recipe .BRecipe ;
3636import com .dre .brewery .utility .Logging ;
3737import org .bukkit .Bukkit ;
4242/**
4343 * General stats written by the original author of Brewery.
4444 */
45- public class BreweryStats {
45+ public class BStatsBrewery {
4646
4747 private static final int BSTATS_ID = 3494 ;
4848
@@ -76,12 +76,12 @@ public void forDrink(Brew brew) {
7676
7777 public void setupBStats () {
7878 try {
79- Metrics metrics = new Metrics (BreweryPlugin .getInstance (), BSTATS_ID );
80- metrics .addCustomChart (new SingleLineChart ("drunk_players" , BPlayer ::numDrunkPlayers ));
81- metrics .addCustomChart (new SingleLineChart ("brews_in_existence" , () -> brewsCreated ));
82- metrics .addCustomChart (new SingleLineChart ("barrels_built" , Barrel .getAllBarrels ()::size ));
83- metrics .addCustomChart (new SingleLineChart ("cauldrons_boiling" , BCauldron .bcauldrons ::size ));
84- metrics .addCustomChart (new AdvancedPie ("brew_quality" , () -> {
79+ BStats bstats = new BStats (BreweryPlugin .getInstance (), BSTATS_ID );
80+ bstats .addCustomChart (new SingleLineChart ("drunk_players" , BPlayer ::numDrunkPlayers ));
81+ bstats .addCustomChart (new SingleLineChart ("brews_in_existence" , () -> brewsCreated ));
82+ bstats .addCustomChart (new SingleLineChart ("barrels_built" , Barrel .getAllBarrels ()::size ));
83+ bstats .addCustomChart (new SingleLineChart ("cauldrons_boiling" , BCauldron .bcauldrons ::size ));
84+ bstats .addCustomChart (new AdvancedPie ("brew_quality" , () -> {
8585 Map <String , Integer > map = new HashMap <>(8 );
8686 map .put ("excellent" , exc );
8787 map .put ("good" , good );
@@ -90,14 +90,14 @@ public void setupBStats() {
9090 map .put ("terrible" , terr );
9191 return map ;
9292 }));
93- metrics .addCustomChart (new AdvancedPie ("brews_created" , () -> {
93+ bstats .addCustomChart (new AdvancedPie ("brews_created" , () -> {
9494 Map <String , Integer > map = new HashMap <>(4 );
9595 map .put ("by command" , brewsCreatedCmd );
9696 map .put ("brewing" , brewsCreated - brewsCreatedCmd );
9797 return map ;
9898 }));
9999
100- metrics .addCustomChart (new SimplePie ("number_of_recipes" , () -> {
100+ bstats .addCustomChart (new SimplePie ("number_of_recipes" , () -> {
101101 int recipes = BRecipe .getAllRecipes ().size ();
102102 if (recipes < 7 ) {
103103 return "Less than 7" ;
@@ -128,7 +128,7 @@ public void setupBStats() {
128128 }
129129
130130 }));
131- metrics .addCustomChart (new SimplePie ("cauldron_particles" , () -> {
131+ bstats .addCustomChart (new SimplePie ("cauldron_particles" , () -> {
132132 if (!config .isEnableCauldronParticles ()) {
133133 return "disabled" ;
134134 }
@@ -137,7 +137,7 @@ public void setupBStats() {
137137 }
138138 return "enabled" ;
139139 }));
140- metrics .addCustomChart (new SimplePie ("wakeups" , () -> {
140+ bstats .addCustomChart (new SimplePie ("wakeups" , () -> {
141141 if (!config .isEnableWake ()) {
142142 return "disabled" ;
143143 }
@@ -154,7 +154,7 @@ public void setupBStats() {
154154 return "More than 20" ;
155155 }
156156 }));
157- metrics .addCustomChart (new SimplePie ("v2_mc_version" , () -> {
157+ bstats .addCustomChart (new SimplePie ("v2_mc_version" , () -> {
158158 String mcv = Bukkit .getBukkitVersion ();
159159 mcv = mcv .substring (0 , mcv .indexOf ('.' , 2 ));
160160 int index = mcv .indexOf ('-' );
@@ -168,7 +168,7 @@ public void setupBStats() {
168168 return "undef" ;
169169 }
170170 }));
171- metrics .addCustomChart (new DrilldownPie ("plugin_mc_version" , () -> {
171+ bstats .addCustomChart (new DrilldownPie ("plugin_mc_version" , () -> {
172172 Map <String , Map <String , Integer >> map = new HashMap <>(3 );
173173 String mcv = Bukkit .getBukkitVersion ();
174174 mcv = mcv .substring (0 , mcv .indexOf ('.' , 2 ));
@@ -187,9 +187,9 @@ public void setupBStats() {
187187 map .put (BreweryPlugin .getInstance ().getDescription ().getVersion (), innerMap );
188188 return map ;
189189 }));
190- metrics .addCustomChart (new SimplePie ("language" , config ::getLanguage ));
191- metrics .addCustomChart (new SimplePie ("config_scramble" , () -> config .isEnableEncode () ? "enabled" : "disabled" ));
192- metrics .addCustomChart (new SimplePie ("config_lore_color" , () -> {
190+ bstats .addCustomChart (new SimplePie ("language" , config ::getLanguage ));
191+ bstats .addCustomChart (new SimplePie ("config_scramble" , () -> config .isEnableEncode () ? "enabled" : "disabled" ));
192+ bstats .addCustomChart (new SimplePie ("config_lore_color" , () -> {
193193 if (config .isColorInBarrels ()) {
194194 if (config .isColorInBrewer ()) {
195195 return "both" ;
@@ -204,7 +204,7 @@ public void setupBStats() {
204204 }
205205 }
206206 }));
207- metrics .addCustomChart (new SimplePie ("config_always_show" , () -> {
207+ bstats .addCustomChart (new SimplePie ("config_always_show" , () -> {
208208 if (config .isAlwaysShowQuality ()) {
209209 if (config .isAlwaysShowAlc ()) {
210210 return "both" ;
0 commit comments