本文整理汇总了Java中org.mcstats.Metrics.Graph类的典型用法代码示例。如果您正苦于以下问题:Java Graph类的具体用法?Java Graph怎么用?Java Graph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Graph类属于org.mcstats.Metrics包,在下文中一共展示了Graph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setQuestAmount
import org.mcstats.Metrics.Graph; //导入依赖的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;
}
});
}
示例2: setTaskAmount
import org.mcstats.Metrics.Graph; //导入依赖的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;
}
});
}
示例3: onEnable
import org.mcstats.Metrics.Graph; //导入依赖的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 :(");
}
}
示例4: onEnable
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
@Override
public void onEnable() {
this.saveDefaultConfig();
getConfig().options().copyDefaults(true);
saveConfig();
if (!setupPermissions()) {
if (getConfig().getBoolean("require-vault")) {
getLogger().severe("Vault not found. Shutting down...");
getServer().getPluginManager().disablePlugin(this);
return;
} else {
getLogger().warning("Vault not found. All players will have permission to execute scripts!");
}
hasPerms = false;
} else {
hasPerms = true;
}
try {
Metrics metrics = new Metrics(this);
Graph VersionDemographics = metrics.createGraph("Version Demographics");
VersionDemographics.addPlotter(new Metrics.Plotter(getDescription().getVersion()) {
@Override
public int getValue() {
return 1;
}
});
metrics.start();
} catch (IOException e) {
//Metrics not available :-(
}
this.getCommand("se").setExecutor(new CommandExecutor(this));
}
示例5: enable
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
@Override
public void enable() {
HeavySpleef heavySpleef = getHeavySpleef();
FlagRegistry flagRegistry = heavySpleef.getFlagRegistry();
flagRegistry.registerInjector(addOnInjector);
File dataFolder = heavySpleef.getDataFolder();
baseDir = new File(dataFolder, BASEDIR_FILE_NAME);
if (!baseDir.exists()) {
baseDir.mkdir();
}
manager = new AddOnManager(heavySpleef);
manager.loadAddOns(baseDir);
manager.enableAddOns();
getLogger().log(Level.INFO, "Add-On load complete. Enabled " + manager.getAddOns().size() + " add-ons");
heavySpleef.getCommandManager().getService().addArgument(manager);
heavySpleef.getCommandManager().registerSpleefCommands(AddOnCommands.class);
Metrics metrics = heavySpleef.getMetrics();
Graph graph = metrics.createGraph(ADDON_GRAPH_NAME);
for (AddOn addon : manager.getAddOns()) {
AddOnProperties properties = addon.getProperties();
graph.addPlotter(new AddOnPlotter(properties));
}
}
示例6: setTest
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
private static void setTest() {
Graph graph = metrics.createGraph("Test");
graph.addPlotter(new Metrics.Plotter("Herp"){
@Override
public int getValue() {
return 4;
}
});
graph.addPlotter(new Metrics.Plotter("Derp"){
@Override
public int getValue() {
return 6;
}
});
}
示例7: setQuestTypes
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
private static void setQuestTypes() {
Graph graph = metrics.createGraph("Average amount of tasks per type");
for(final TaskTypes type : questTypeAmount.keySet()){
graph.addPlotter(new Metrics.Plotter(type.toString().toLowerCase()){
@Override
public int getValue() {
return questTypeAmount.get(type);
}
});
}
}
示例8: setRewardTypes
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
private static void setRewardTypes() {
Graph graph = metrics.createGraph("Average amount of rewards per type");
for(final RewardTypes type : rewardTypeAmount.keySet()){
graph.addPlotter(new Metrics.Plotter(type.toString().toLowerCase()){
@Override
public int getValue() {
return rewardTypeAmount.get(type);
}
});
}
}
示例9: setOptions
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
private static void setOptions() {
//Permissions
Graph graphPermissions = metrics.createGraph("Permissions enabled");
graphPermissions.addPlotter(new Metrics.Plotter(EpicSystem.usePermissions() ? "True" : "False"){
@Override
public int getValue() {
return 1;
}
});
//Quest book
Graph graphBook = metrics.createGraph("Book enabled");
graphBook.addPlotter(new Metrics.Plotter(EpicSystem.useBook() ? "True" : "False"){
@Override
public int getValue() {
return 1;
}
});
//Heroes
Graph graphHeroes = metrics.createGraph("Heroes enabled");
graphHeroes.addPlotter(new Metrics.Plotter(EpicSystem.useHeroes() ? "True" : "False"){
@Override
public int getValue() {
return 1;
}
});
//Citizens
Graph graphCitizens = metrics.createGraph("Citizens enabled");
graphCitizens.addPlotter(new Metrics.Plotter(EpicSystem.useCitizens() ? "True" : "False"){
@Override
public int getValue() {
return 1;
}
});
}
示例10: generateData
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
/**
* Generates data for mcstats.org.
*/
public void generateData() {
try {
Metrics metrics = new Metrics(Main.getInstance());
Graph enabledFeatures = metrics.createGraph("Enabled Features");
if (Main.getInstance().getConfig().getBoolean("chat.prefix.enabled")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Prefix") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getConfig().getBoolean("chat.suffix.enabled")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Suffix") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getConfig().getBoolean("general.updater.checkForUpdates")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Update checking") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getConfig().getBoolean("chat.randomizeMessages")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Message randomizing") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getConfig().getBoolean("chat.requireOnlinePlayers")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Online players required") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getConfig().getBoolean("chat.showMessagesInConsole")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Console messages") {
@Override
public int getValue() {
return 1;
}
});
}
if (Main.getInstance().getBossBarConfig().getBoolean("bossbar.enabled")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Bossbar") {
@Override
public int getValue() {
return 1;
}
});
if (Main.getInstance().getBossBarConfig().getBoolean("bossbar.reduceHealthBar")) {
enabledFeatures.addPlotter(new Metrics.Plotter("Reduce health bar") {
@Override
public int getValue() {
return 1;
}
});
}
}
metrics.start();
} catch (IOException e) {
Main.getInstance().getLogger().log(Level.WARNING, "An error occured while generating stats for mcstats.org");
}
}
示例11: doMetric
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
/**
* Metrics
*/
private void doMetric() {
try {
Metrics metrics = new Metrics(this);
final PlotMeCoreManager manager = PlotMeCoreManager.getInstance();
Graph graphNbWorlds = metrics.createGraph("PlotWorlds");
graphNbWorlds.addPlotter(new Metrics.Plotter("Number of PlotWorlds") {
@Override
public int getValue() {
return manager.getPlotMaps().size();
}
});
graphNbWorlds.addPlotter(new Metrics.Plotter("Average Plot Size") {
@Override
public int getValue() {
if (!manager.getPlotMaps().isEmpty()) {
int totalPlotSize = 0;
for (IWorld plotter : manager.getPlotMaps().keySet()) {
IPlotMe_GeneratorManager genmanager = plotme.getGenManager(plotter);
if (genmanager != null) {
totalPlotSize += genmanager.getPlotSize();
}
}
return totalPlotSize / manager.getPlotMaps().size();
} else {
return 0;
}
}
});
graphNbWorlds.addPlotter(new Metrics.Plotter("Number of plots") {
@Override
public int getValue() {
return getAPI().getSqlManager().getTotalPlotCount();
}
});
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
}
示例12: init
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
public static void init() {
try {
MessageManager.log(MessageType.INFO, "Loading MCStats integration...");
Metrics m = new Metrics(Minotaurus.getInstance());
Graph arenas = m.createGraph("Installed");
arenas.addPlotter(new Metrics.Plotter("Arenas") {
@Override
public int getValue() {
int ret = ArenaManager.getArenas().size();
MessageManager.log(MessageType.INFO, "Adding " + ret + " to Arenas plotter!");
return ret;
}
});
Graph dbtype = m.createGraph("Database type");
if (Config.USE_MYSQL.getBoolean()) {
dbtype.addPlotter(new Metrics.Plotter("MySQL") {
@Override
public int getValue() {
MessageManager.log(MessageType.INFO, "Adding 1 to MySQL plotter!");
return 1;
}
});
} else {
dbtype.addPlotter(new Metrics.Plotter("SQLite") {
@Override
public int getValue() {
MessageManager.log(MessageType.INFO, "Adding 1 to SQLite plotter!");
return 1;
}
});
}
MessageManager.log(MessageType.INFO, "Start collectiong data...");
m.start();
MessageManager.log(MessageType.INFO, "Done!");
} catch (IOException ex) {
MessageManager.debug("Could not start metrics.");
}
}
示例13: onEnable
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
@Override
public void onEnable() {
Information.BusinessCore = this;
Information.config = this.getConfig();
this.getLogger().log(Level.INFO, "Loaded Economy: {0}", setupEconomy());
this.getLogger().log(Level.INFO, "Loaded Chat: {0}", setupChat());
Information.initFiles(this);
FileFunctions.load();
registerListeners();
registerCommands();
Information.log = this.getLogger();
if (getConfig().getBoolean("firstrun")) {
saveDefaultConfig();
this.reloadConfig();
getConfig().set("firstrun", false);
this.saveConfig();
} else {
Information.debug = getConfig().getBoolean("debug-message");
if(getConfig().getBoolean("managers")) {
Information.managers = true;
initManagers(this);
} else {
Information.managers = false;
}
Information.prefix = getConfig().getBoolean("prefixes.enabled");
BusinessManager.createBusinesses();
EmployeeManager.loadEmployees();
JobManager.loadJobs();
}
try {
Metrics metrics = new Metrics(this);
Graph businessesCreated = metrics.createGraph("Number of Businesses Created");
businessesCreated.addPlotter(new Metrics.Plotter("Businesses") {
@Override
public int getValue() {
return Business.businessList.size();
}
});
Graph jobsCompleted = metrics.createGraph("Number of Jobs Completed");
jobsCompleted.addPlotter(new Metrics.Plotter("Jobs") {
@Override
public int getValue() {
return Job.jobList.size();
}
});
metrics.start();
} catch (IOException e) {
this.getLogger().severe("Failed to send stats :-(");
}
Scheduler.runPayPeriod();
getLogger().info("Do /businesscore for information about this plugin");
}
示例14: onEnable
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
@Override
public void onEnable() {
Locale.init(this);
updateConfig();
WorldGuard.init(this);
ConfigurationSection conf = getConfig();
if (conf.getBoolean("autoupdate", true)) {
new Updater(this, "rpg-items", this.getFile(), Updater.UpdateType.DEFAULT, false);
}
if (conf.getBoolean("localeInv", false)) {
Events.useLocaleInv = true;
}
getServer().getPluginManager().registerEvents(new Events(), this);
ItemManager.load(this);
try {
Metrics metrics = new Metrics(this);
metrics.addCustomData(new Metrics.Plotter("Total Items") {
@Override
public int getValue() {
return ItemManager.itemByName.size();
}
});
Graph graph = metrics.createGraph("Power usage");
for (String powerName : Power.powers.keySet()) {
graph.addPlotter(new Metrics.Plotter(powerName) {
@Override
public int getValue() {
return Power.powerUsage.get(getColumnName());
}
});
}
metrics.addGraph(graph);
metrics.start();
} catch (Exception e) {
}
Commands.register(new Handler());
Commands.register(new PowerHandler());
new PowerTicker().runTaskTimer(this, 0, 1);
}
示例15: onEnable
import org.mcstats.Metrics.Graph; //导入依赖的package包/类
@Override
public void onEnable() {
saveDefaultConfig();
Bukkit.getServer().getPluginManager().registerEvents(this, this);
try {
Metrics metrics = new Metrics(this);
Graph weaponsUsedGraph = metrics.createGraph("TEST");
weaponsUsedGraph.addPlotter(new Metrics.Plotter("1") {
@Override
public int getValue() {
return 4; // Number of players who used a diamond sword
}
});
weaponsUsedGraph.addPlotter(new Metrics.Plotter("2") {
@Override
public int getValue() {
return 17;
}
});
metrics.start();
} catch (IOException e) {
this.getLogger().warning("Couldn't submit stats to Metrics!");
}
@SuppressWarnings("unused")
Updater updater = new Updater(this, 66804, getFile(), UpdateType.DEFAULT, true);
}