本文整理汇总了Java中org.mcstats.Metrics类的典型用法代码示例。如果您正苦于以下问题:Java Metrics类的具体用法?Java Metrics怎么用?Java Metrics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Metrics类属于org.mcstats包,在下文中一共展示了Metrics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEnable
import org.mcstats.Metrics; //导入依赖的package包/类
public void onEnable() {
getConfig().options().copyDefaults(true);
saveDefaultConfig();
this.pluginconfig = new Config(this,getConfig());
this.saveBlocks();
this.saveMobs();
this.saveTools();
getBlocks();
getMobs();
getTools();
/* enable metrics */
if (pluginconfig.isMetrics()) {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
MessageUtil.sendConsoleMessage("Failed to start Metrics!");
}
}
}
示例2: setupMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
/**
* Setups metrics
*
* @throws IOException if fails
*/
private void setupMetrics() throws IOException {
Metrics metrics = new Metrics(this);
Metrics.Graph guildsAndUsersGraph = metrics.createGraph("Guilds and users");
guildsAndUsersGraph.addPlotter(new Metrics.Plotter("Guilds") {
@Override
public int getValue() {
return getGuildManager().getGuilds().size();
}
});
guildsAndUsersGraph.addPlotter(new Metrics.Plotter("Users") {
@Override
public int getValue() {
return getPlayerManager().getPlayers().size();
}
});
metrics.start();
}
示例3: onEnable
import org.mcstats.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {
saveDefaultConfig();
plugin = this;
DEListener listener = new DEListener();
getServer().getPluginManager().registerEvents(listener, plugin);
boolean isBroadcast = getConfig().getBoolean("config.broadcast.use");
if (isBroadcast) {
DEThread deThread = new DEThread();
deThread.start();
}
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "梦梦家高性能服务器出租");
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "淘宝店 http://shop105595113.taobao.com");
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
e.printStackTrace();
}
}
示例4: setupMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
private void setupMetrics()
{
if (getConfig().getBoolean("MetricsEnabled"))
{
try
{
Metrics metrics = new Metrics(this);
metrics.start();
getLogger().info("Metrics connection established.");
}
catch (IOException e)
{
getLogger().severe("Failed to connect to mcstats.org!");
}
}
}
示例5: onEnable
import org.mcstats.Metrics; //导入依赖的package包/类
public void onEnable() {
plugin = this;
parkoursManager = new ParkoursManager();
timesManager = new TimesManager();
playersManager = new PlayersManager();
loadConfigs();
setupMysql();
getCommand("parkour").setExecutor(new PlayersCommands());
getServer().getPluginManager().registerEvents(new PlayersListeners(), this);
parkoursManager.loadParkours();
timesManager.loadTimes();
Lobby.load();
try {
new Metrics(this).start();
} catch (IOException e) {
e.printStackTrace();
}
}
示例6: addArena
import org.mcstats.Metrics; //导入依赖的package包/类
public void addArena(final Arena arena) {
arenasBeingPlayedGraph.addPlotter(new Metrics.Plotter(arena.getGame().getName() + " : " + arena.getName()) {
@Override
public int getValue() {
if (arena.getStatus() == ArenaStatus.RUNNING) {
return 1;
} else {
return 0;
}
}
});
playersInArenasGraph.addPlotter(new Metrics.Plotter(arena.getGame().getName() + " : " + arena.getName()) {
@Override
public int getValue() {
return arena.getPlayers().size();
}
});
}
示例7: removeArena
import org.mcstats.Metrics; //导入依赖的package包/类
public void removeArena(final Arena arena) {
arenasBeingPlayedGraph.removePlotter(new Metrics.Plotter(arena.getGame().getName() + " : " + arena.getName()) {
@Override
public int getValue() {
if (arena.getStatus() == ArenaStatus.RUNNING) {
return 1;
} else {
return 0;
}
}
});
playersInArenasGraph.removePlotter(new Metrics.Plotter(arena.getGame().getName() + " : " + arena.getName()) {
@Override
public int getValue() {
return arena.getPlayers().size();
}
});
}
示例8: setQuestAmount
import org.mcstats.Metrics; //导入依赖的package包/类
private static void setQuestAmount(){
Graph graph = metrics.createGraph("Average amount of quests");
int range = 0;
int interval = 5;
for(int i = 0; i < questAmount + 1; i++){
range = interval * i;
if(questAmount > range && questAmount <= range + interval){
break;
}
}
graph.addPlotter(new Metrics.Plotter((range + 1) + "-" + (range + interval)){
@Override
public int getValue() {
return 1;
}
});
}
示例9: setTaskAmount
import org.mcstats.Metrics; //导入依赖的package包/类
private static void setTaskAmount() {
Graph graph = metrics.createGraph("Average amount of tasks");
int range = 0;
int interval = 10;
for(int i = 0; i < taskAmount + 1; i++){
range = interval * i;
if(taskAmount > range && taskAmount <= range + interval){
break;
}
}
graph.addPlotter(new Metrics.Plotter((range + 1) + "-" + (range + interval)){
@Override
public int getValue() {
return 1;
}
});
}
示例10: onEnable
import org.mcstats.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
System.out.println(getServer().getBukkitVersion());
LoadConfig();
}
示例11: initMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
public void initMetrics() throws IOException {
Metrics metrics = new Metrics(this);
Metrics.Graph enabledModes = metrics.createGraph("Enabled Services");
enabledModes.addPlotter(new Metrics.Plotter("Google Drive") {
@Override
public int getValue() {
return Config.isGoogleEnabled() ? 1 : 0;
}
});
enabledModes.addPlotter(new Metrics.Plotter("OneDrive") {
@Override
public int getValue() {
return Config.isOnedriveEnabled() ? 1 : 0;
}
});
enabledModes.addPlotter(new Metrics.Plotter("FTP") {
@Override
public int getValue() {
return Config.isFtpEnabled() ? 1 : 0;
}
});
enabledModes.addPlotter(new Metrics.Plotter("None") {
@Override
public int getValue() {
return Config.isOnedriveEnabled() || Config.isGoogleEnabled() || Config.isFtpEnabled() ? 0 : 1;
}
});
metrics.start();
}
示例12: startMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
protected void startMetrics () {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
getLogger().warning("Failed to start metrics.");
}
}
示例13: setupMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
/**
* Automatically sets up MC-Stats Metrics for you
*/
public void setupMetrics() {
try {
Metrics metrics = new Metrics(plugin);
metrics.start();
} catch (IOException e) {
}
}
示例14: onEnable
import org.mcstats.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {
getOrRegisterDownloadPerm();
getServer().getPluginManager().registerEvents(this, this);
try {
class StringPlotter extends Plotter {
public StringPlotter(String str) {
super(str);
}
@Override
public int getValue() {
return 1;
}
}
Metrics metrics = new Metrics(this);
Graph factionsVersionGraph = metrics.createGraph("factionsVersion");
String factionsVersion = getProvidingPlugin(Factions.class)
.getDescription().getFullName();
factionsVersionGraph.addPlotter(new StringPlotter(factionsVersion));
Graph massiveCoreVersionGraph = metrics.createGraph("massiveCoreVersion");
String massiveCoreVersion = getProvidingPlugin(MassiveCore.class)
.getDescription().getFullName();
massiveCoreVersionGraph.addPlotter(new StringPlotter(massiveCoreVersion));
Graph wdlcVersionGraph = metrics.createGraph("wdlcompanionVersion");
String wdlcVersion = getProvidingPlugin(IRangeProducer.class)
.getDescription().getFullName();
wdlcVersionGraph.addPlotter(new StringPlotter(wdlcVersion));
metrics.start();
} catch (Exception e) {
getLogger().warning("Failed to start PluginMetrics :(");
}
}
示例15: initMetrics
import org.mcstats.Metrics; //导入依赖的package包/类
public void initMetrics() {
if (getConfig().getBoolean("enable-metrics")) {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException ex) {
ex.printStackTrace();
getLogger().severe("Failed to enable Plugin Metrics!");
}
}
}