mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-02 22:47:41 +01: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
@ -189,7 +189,7 @@ public class Metrics {
|
|||||||
public JSONObject getPluginData() {
|
public JSONObject getPluginData() {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
|
|
||||||
String pluginName = "EssentialsX";
|
String pluginName = plugin.getDescription().getName().replace("Essentials", "EssentialsX");
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
data.put("pluginName", pluginName); // Append the name of the plugin
|
data.put("pluginName", pluginName); // Append the name of the plugin
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.antibuild;
|
package com.earth2me.essentials.antibuild;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
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, Boolean> settingsBoolean = new EnumMap<>(AntiBuildConfig.class);
|
||||||
private final transient Map<AntiBuildConfig, List<Material>> settingsList = new EnumMap<>(AntiBuildConfig.class);
|
private final transient Map<AntiBuildConfig, List<Material>> settingsList = new EnumMap<>(AntiBuildConfig.class);
|
||||||
private transient EssentialsConnect ess = null;
|
private transient EssentialsConnect ess = null;
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -26,6 +28,10 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
|||||||
|
|
||||||
final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
|
final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
|
||||||
pm.registerEvents(blockListener, this);
|
pm.registerEvents(blockListener, this);
|
||||||
|
|
||||||
|
if (metrics == null) {
|
||||||
|
metrics = new Metrics(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.chat;
|
package com.earth2me.essentials.chat;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
@ -16,6 +17,7 @@ import static com.earth2me.essentials.I18n.tl;
|
|||||||
|
|
||||||
public class EssentialsChat extends JavaPlugin {
|
public class EssentialsChat extends JavaPlugin {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -38,5 +40,9 @@ public class EssentialsChat extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(playerListenerNormal, this);
|
pluginManager.registerEvents(playerListenerNormal, this);
|
||||||
pluginManager.registerEvents(playerListenerHighest, this);
|
pluginManager.registerEvents(playerListenerHighest, this);
|
||||||
|
|
||||||
|
if (metrics == null) {
|
||||||
|
metrics = new Metrics(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.geoip;
|
package com.earth2me.essentials.geoip;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -10,6 +11,8 @@ import static com.earth2me.essentials.I18n.tl;
|
|||||||
|
|
||||||
|
|
||||||
public class EssentialsGeoIP extends JavaPlugin {
|
public class EssentialsGeoIP extends JavaPlugin {
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
public EssentialsGeoIP() {
|
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/.");
|
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;
|
package com.earth2me.essentials.protect;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
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, String> settingsString = new EnumMap<>(ProtectConfig.class);
|
||||||
private final Map<ProtectConfig, List<Material>> settingsList = new EnumMap<>(ProtectConfig.class);
|
private final Map<ProtectConfig, List<Material>> settingsList = new EnumMap<>(ProtectConfig.class);
|
||||||
private EssentialsConnect ess = null;
|
private EssentialsConnect ess = null;
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
private final EmergencyListener emListener = new EmergencyListener(this);
|
private final EmergencyListener emListener = new EmergencyListener(this);
|
||||||
|
|
||||||
@ -33,6 +35,10 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialize(pm, essPlugin);
|
initialize(pm, essPlugin);
|
||||||
|
|
||||||
|
if (metrics == null) {
|
||||||
|
metrics = new Metrics(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(final PluginManager pm, final Plugin essPlugin) {
|
private void initialize(final PluginManager pm, final Plugin essPlugin) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.spawn;
|
package com.earth2me.essentials.spawn;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -25,6 +26,7 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
|||||||
private static final Logger LOGGER = Bukkit.getLogger();
|
private static final Logger LOGGER = Bukkit.getLogger();
|
||||||
private transient IEssentials ess;
|
private transient IEssentials ess;
|
||||||
private transient SpawnStorage spawns;
|
private transient SpawnStorage spawns;
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -62,6 +64,10 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
|||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (metrics == null) {
|
||||||
|
metrics = new Metrics(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.xmpp;
|
package com.earth2me.essentials.xmpp;
|
||||||
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import net.ess3.api.IUser;
|
import net.ess3.api.IUser;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -22,6 +23,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
|||||||
private transient UserManager users;
|
private transient UserManager users;
|
||||||
private transient XMPPManager xmpp;
|
private transient XMPPManager xmpp;
|
||||||
private transient IEssentials ess;
|
private transient IEssentials ess;
|
||||||
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
public static IEssentialsXMPP getInstance() {
|
public static IEssentialsXMPP getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
@ -49,6 +51,11 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
|||||||
|
|
||||||
ess.addReloadListener(users);
|
ess.addReloadListener(users);
|
||||||
ess.addReloadListener(xmpp);
|
ess.addReloadListener(xmpp);
|
||||||
|
|
||||||
|
if (metrics == null) {
|
||||||
|
metrics = new Metrics(this);
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("config-valid", () -> xmpp.isConfigValid() ? "yes" : "no"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -318,4 +318,9 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||||||
chats.remove(address);
|
chats.remove(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConfigValid() {
|
||||||
|
final String server = config.getString("xmpp.server");
|
||||||
|
return server != null && server.equals("example.com");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user