当前位置: 首页>>代码示例>>Java>>正文


Java Metrics类代码示例

本文整理汇总了Java中org.bstats.bukkit.Metrics的典型用法代码示例。如果您正苦于以下问题:Java Metrics类的具体用法?Java Metrics怎么用?Java Metrics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Metrics类属于org.bstats.bukkit包,在下文中一共展示了Metrics类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void start() {
    try {
        metrics = new Metrics(voxelGamesLib);
        //TODO add custom charts, like user/gamemode, installed gamesmodes, user/lang, installed langs etc

        // gamemodes multiline TODO enable this on the bstats page once its implemented....
        metrics.addCustomChart(new Metrics.MultiLineChart("gamemodes", () -> {
            Map<String, Integer> valueMap = new HashMap<>();
            gameHandler.getGameModes().forEach((gm) -> valueMap.put(gm.getName(), 1));
            return valueMap;
        }));
    } catch (Throwable ex) {
        log.warning("Metrics failed to enabled. This is not a critical problem. You can ignore it.");
    }
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:17,代码来源:MetricHandler.java

示例2: onEnable

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {
    // All you have to do is adding this line in your onEnable method:
    Metrics metrics = new Metrics(this);

    // Optional: Add custom charts
    metrics.addCustomChart(new Metrics.SimplePie("chart_id", new Callable<String>() {
        @Override
        public String call() throws Exception {
            return "My value";
        }
    }));

    // If you use Java 8 you can use Lambdas:
    // metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value"));
}
 
开发者ID:BtoBastian,项目名称:bStats-Metrics,代码行数:17,代码来源:ExamplePlugin.java

示例3: onEnable

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {

    //Metrics powered by bstats.org
    Metrics metrics = new Metrics(this);

    this.saveDefaultConfig();
    int bufferSize = getConfig().getInt("bufferSize");
    if (bufferSize <= 0) {
        logger.info(this.getName() + ": Invalid bufferSize " + bufferSize + "! Must be greater 0");
    }
    chatBuffer = new ChatBuffer(
            bufferSize,
            getConfig().getString("replayHeader"),
            getConfig().getString("replayFooter"),
            getConfig().getString("replayMsgFormat"),
            getConfig().getString("replayMsgHover"));

    getServer().getPluginManager().registerEvents(this, this);
}
 
开发者ID:Tallcraft,项目名称:ChatReplay,代码行数:21,代码来源:ChatReplay.java

示例4: init

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void init(JavaPlugin plugin) {
    // Main
    File configFile = new File(new File(plugin.getDataFolder().getParentFile(), "bStats"), "config.yml");
    YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
    if (!config.getBoolean("enabled", true)) {
        config.set("enabled", true);
        try {
            config.save(configFile);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        Static.log(ChatColor.RED + "bStats 가 비활성화되어있어 활성화했습니다.");
    }
    Metrics metrics = new Metrics(plugin);
    metrics.addCustomChart(new Metrics.AdvancedPie("players_by_server", () -> {
        Map<String, Integer> map = new HashMap<>();
        map.put(Static.getAddress(), Static.getOnlinePlayers().size());
        return map;
    }));
}
 
开发者ID:EntryPointKR,项目名称:K-Security,代码行数:22,代码来源:BStatsInitializer.java

示例5: onEnable

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {

    if (!isAboveMC18()) {
        getLogger().info("[TradeShop] Minecraft versions before 1.9 are not supported beyond TradeShop version 1.5.2!");
        getServer().getPluginManager().disablePlugin(this);
        return;
    }

    createConfigs();
    reloadConfig();

    PluginManager pm = getServer().getPluginManager();
    pm.registerEvents(new TradeEventListener(this), this);
    pm.registerEvents(new ShopCreateEventListener(this), this);
    pm.registerEvents(new BiTradeEventListener(this), this);
    pm.registerEvents(new BiShopCreateEventListener(this), this);
    pm.registerEvents(new ShopProtectionHandler(this), this);
    pm.registerEvents(new ITradeEventListener(this), this);
    pm.registerEvents(new IShopCreateEventListener(this), this);

    getCommand("tradeshop").setExecutor(new Executor(this));

    boolean checkUpdates = getSettings().getBoolean("check-updates");
    if (checkUpdates) {
        new Thread(() -> new Updater(getDescription()).checkCurrentVersion()).start();
    }
    
    if (getSettings().getBoolean("allow-metrics")) {
        metrics = new Metrics(this);
        getLogger().info("Metrics successfully initialized!");
        
    } else {
        getLogger().warning("Metrics are disabled! Please consider enabling them to support the authors!");
    }
}
 
开发者ID:SparklingComet,项目名称:TradeShop,代码行数:37,代码来源:TradeShop.java

示例6: onEnable

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void onEnable() {
    instance = this;
    //根據不同版本選擇Handler
    String version = getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
    switch (version) {
        case "v1_8_R1":
        case "v1_8_R2":
        case "v1_8_R3":
            versionHandler = new VersionHandler_1_8();
            break;
        default:
            versionHandler = new VersionHandler();
            break;
    }

    //Commands
    registerCommands();

    //CustomGUI
    CustomGUI.enable();
    //Config
    List<String> configList = Arrays.asList("config", "price");
    for (String config : configList) {
        KConfigManager.load(config);
    }
    //Reload
    reload();
    //bStats
    Metrics metrics = new Metrics(this);
}
 
开发者ID:jyhsu2000,项目名称:BannerMaker,代码行数:32,代码来源:BannerMaker.java

示例7: sendMetrics

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
/**
 * Sends bstats metrics.
 *
 * @param plugin the plugin instance
 * @param settings the settings
 */
public static void sendMetrics(AuthMe plugin, Settings settings) {
    final Metrics metrics = new Metrics(plugin);

    metrics.addCustomChart(new Metrics.SimplePie("messages_language",
        () -> settings.getProperty(PluginSettings.MESSAGES_LANGUAGE)));
    metrics.addCustomChart(new Metrics.SimplePie("database_backend",
        () -> settings.getProperty(DatabaseSettings.BACKEND).toString()));
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:15,代码来源:OnStartupTasks.java

示例8: setupMetrics

import org.bstats.bukkit.Metrics; //导入依赖的package包/类
@Override
public void setupMetrics() {
    Metrics metrics = new Metrics((JavaPlugin) getPlugin());
    metrics.addCustomChart(new Metrics.SimplePie("MySQL", () -> DatabaseManager.get().isUseMySQL() ? "yes" : "no"));
}
 
开发者ID:DevLeoko,项目名称:AdvancedBan,代码行数:6,代码来源:BukkitMethods.java


注:本文中的org.bstats.bukkit.Metrics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。