From 49530f806d79e2261dfb5da68175c2da4f84263c Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 16 Sep 2015 21:16:21 +0200 Subject: [PATCH] Added Graph "Shop Type" to Statistics Page (Still Testing) --- plugin.yml | 2 +- src/de/epiceric/shopchest/ShopChest.java | 33 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 9b691e6..9ca325b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: ShopChest main: de.epiceric.shopchest.ShopChest -version: 1.6.0 +version: 1.6.0.1 author: EpicEric website: https://www.spigotmc.org/resources/shopchest.11431/ depend: [Vault] diff --git a/src/de/epiceric/shopchest/ShopChest.java b/src/de/epiceric/shopchest/ShopChest.java index e1143a2..0eff2f0 100644 --- a/src/de/epiceric/shopchest/ShopChest.java +++ b/src/de/epiceric/shopchest/ShopChest.java @@ -39,6 +39,8 @@ import de.epiceric.shopchest.interfaces.jsonbuilder.JsonBuilder_R1; import de.epiceric.shopchest.interfaces.jsonbuilder.JsonBuilder_R2; import de.epiceric.shopchest.interfaces.jsonbuilder.JsonBuilder_R3; import de.epiceric.shopchest.utils.Metrics; +import de.epiceric.shopchest.utils.Metrics.Graph; +import de.epiceric.shopchest.utils.Metrics.Plotter; import de.epiceric.shopchest.utils.ShopUtils; import de.epiceric.shopchest.utils.UpdateChecker; import net.milkbowl.vault.economy.Economy; @@ -104,6 +106,37 @@ public class ShopChest extends JavaPlugin{ try { Metrics metrics = new Metrics(this); + Graph shopType = metrics.createGraph("Shop Type"); + + shopType.addPlotter(new Plotter("Infinite") { + + @Override + public int getValue() { + int value = 0; + + for (Shop shop : ShopUtils.getShops()) { + if (shop.isInfinite()) value++; + } + + return value; + } + }); + + shopType.addPlotter(new Plotter("Normal") { + + @Override + public int getValue() { + int value = 0; + + for (Shop shop : ShopUtils.getShops()) { + if (!shop.isInfinite()) value++; + } + + return value; + } + + }); + metrics.start(); } catch (IOException e) { logger.severe("Could not submit stats.");