mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-12-28 11:04:21 +00:00
Add bStats metrics for each EssentialsX module (#2333)
Does what it says on the tin.
This commit is contained in:
parent
4adb669cdd
commit
8882e0214c
8 changed files with 44 additions and 1 deletions
|
@ -189,7 +189,7 @@ public class Metrics {
|
|||
public JSONObject getPluginData() {
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
String pluginName = "EssentialsX";
|
||||
String pluginName = plugin.getDescription().getName().replace("Essentials", "EssentialsX");
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.put("pluginName", pluginName); // Append the name of the plugin
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.antibuild;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
@ -14,6 +15,7 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
|||
private final transient Map<AntiBuildConfig, Boolean> settingsBoolean = new EnumMap<>(AntiBuildConfig.class);
|
||||
private final transient Map<AntiBuildConfig, List<Material>> settingsList = new EnumMap<>(AntiBuildConfig.class);
|
||||
private transient EssentialsConnect ess = null;
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -26,6 +28,10 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
|||
|
||||
final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.chat;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
@ -16,6 +17,7 @@ import static com.earth2me.essentials.I18n.tl;
|
|||
|
||||
public class EssentialsChat extends JavaPlugin {
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -38,5 +40,9 @@ public class EssentialsChat extends JavaPlugin {
|
|||
pluginManager.registerEvents(playerListenerNormal, this);
|
||||
pluginManager.registerEvents(playerListenerHighest, this);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.geoip;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -10,6 +11,8 @@ import static com.earth2me.essentials.I18n.tl;
|
|||
|
||||
|
||||
public class EssentialsGeoIP extends JavaPlugin {
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
public EssentialsGeoIP() {
|
||||
}
|
||||
|
||||
|
@ -33,5 +36,9 @@ public class EssentialsGeoIP extends JavaPlugin {
|
|||
|
||||
|
||||
getLogger().log(Level.INFO, "This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com/.");
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.protect;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
@ -20,6 +21,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
|||
private final Map<ProtectConfig, String> settingsString = new EnumMap<>(ProtectConfig.class);
|
||||
private final Map<ProtectConfig, List<Material>> settingsList = new EnumMap<>(ProtectConfig.class);
|
||||
private EssentialsConnect ess = null;
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
private final EmergencyListener emListener = new EmergencyListener(this);
|
||||
|
||||
|
@ -33,6 +35,10 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
|||
}
|
||||
|
||||
initialize(pm, essPlugin);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void initialize(final PluginManager pm, final Plugin essPlugin) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.spawn;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -25,6 +26,7 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
|||
private static final Logger LOGGER = Bukkit.getLogger();
|
||||
private transient IEssentials ess;
|
||||
private transient SpawnStorage spawns;
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -62,6 +64,10 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
|||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -22,6 +23,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
|||
private transient UserManager users;
|
||||
private transient XMPPManager xmpp;
|
||||
private transient IEssentials ess;
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
public static IEssentialsXMPP getInstance() {
|
||||
return instance;
|
||||
|
@ -49,6 +51,11 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
|||
|
||||
ess.addReloadListener(users);
|
||||
ess.addReloadListener(xmpp);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
metrics.addCustomChart(new Metrics.SimplePie("config-valid", () -> xmpp.isConfigValid() ? "yes" : "no"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -318,4 +318,9 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
chats.remove(address);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConfigValid() {
|
||||
final String server = config.getString("xmpp.server");
|
||||
return server != null && server.equals("example.com");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue