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


Java Plugin类代码示例

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


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

示例1: Metrics

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
public Metrics(final Plugin plugin) throws IOException {
    if (plugin == null) {
        throw new IllegalArgumentException("Plugin cannot be null");
    }

    this.plugin = plugin;

    // load the config
    configuration = plugin.getModuleConfig("PluginMetrics");

    // Do we need to create the file?
    if (!configuration.containsKey("guid")) {
        // add some defaults
        configuration.addHeaderLines("http://mcstats.org");
        configuration.getBoolean("opt-out", false);
        configuration.getString("guid", UUID.randomUUID().toString());
        configuration.getBoolean("debug", false);
        configuration.save();
    }

    // Load the guid then
    guid = configuration.getString("guid");
    debug = configuration.getBoolean("debug", false);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:25,代码来源:Metrics.java

示例2: onPopulateEnvironment

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
@Inject(method = "populateEnvironment", at = @At("RETURN"))
private void onPopulateEnvironment(CallbackInfo ci) {
    if (Canary.pluginManager() != null) {
        this.theReportCategory.addCrashSectionCallable("Canary Plugins", () -> {
            final StringBuilder result = new StringBuilder(64);
            for (final Plugin plugin : Canary.pluginManager().getPlugins()) {
                result.append("\n\t\t")
                        .append(plugin.getName())
                        .append(" v ")
                        .append(plugin.getVersion())
                        .append(" (")
                        .append(plugin.getPath())
                        .append(")");
            }
            return result.toString();
        });
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:19,代码来源:MixinCrashReport.java

示例3: enable

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
@Override
public boolean enable() {
    if (Bukkit.getServer() == null) {
        server = new CanaryServer(Canary.getServer(), getLogman());
    }
    // Enable Listener
    Canary.hooks().registerListener(new CanaryPlayerListener(server), this);
    Canary.hooks().registerListener(new CanaryBlockListener(server), this);
    Canary.hooks().registerListener(new CanaryWorldListener(server), this);
    Canary.hooks().registerListener(new CanaryServerListener(server), this);

    // Create all the directories.
    Constants.createDirectories();

    // Start server
    server.start();

    // Metrics (statistics)
    try {
        Metrics metrics = new Metrics(this);

        Metrics.Graph plugins = metrics.createGraph("Plugins");
        for (org.bukkit.plugin.Plugin plugin : server.getPluginManager().getPlugins()) {
            plugins.addPlotter(new Metrics.Plotter(plugin.getName()) {
                @Override
                public int getValue() {
                    return 1;
                }
            });
        }

        metrics.start();
    } catch (IOException e) {
        getLogman().warn("Failed to send statistics to Metrics", e);
    }

    return true;
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:39,代码来源:CanaryBukkit.java

示例4: exportResource

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
static public boolean exportResource(final Plugin plugin, final String resourceName,
                                     final File targetDir) throws IOException {
    boolean success = false;

    final File targetFile = new File(targetDir, resourceName);
    if (!targetFile.exists()) {
        final InputStream in = plugin.getClass().getResourceAsStream("/" + resourceName);
        OutputStream out = null;
        if (in != null) {
            try {
                if (targetDir.mkdirs()) {
                    if (targetFile.createNewFile()) {
                        int readBytes;
                        final byte[] buffer = new byte[1024];
                        out = new FileOutputStream(targetFile);
                        while ((readBytes = in.read(buffer)) > 0) {
                            out.write(buffer, 0, readBytes);
                        }

                        plugin.getLogman().info("Wrote default " + resourceName);
                        success = true;
                    }
                }
            } finally {
                in.close();
                if (out != null) {
                    out.close();
                }
            }
        }
    }

    return success;
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:35,代码来源:JarUtil.java

示例5: createCrashSectionMessage

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
public static String createCrashSectionMessage() {
    StringBuilder result = new StringBuilder(64);
    for (Plugin plugin : Canary.pluginManager().getPlugins()) {
        result.append("\n\t\t").append(plugin.getName());
    }
    return result.toString();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:8,代码来源:CrashReportHelper.java

示例6: LatchConfig

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
/**
 * Constructor.
 */
public LatchConfig(Plugin plugin) {
    config = Configuration.getPluginConfig(plugin);
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:7,代码来源:LatchConfig.java

示例7: CanaryServer

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
public CanaryServer(Server server, Plugin plugin) {
    this.server = server;
    this.plugin = plugin;
}
 
开发者ID:UnoModding,项目名称:cynmap,代码行数:5,代码来源:CanaryServer.java

示例8: CanaryConfigurationStorage

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
public CanaryConfigurationStorage(Plugin plugin) {
    this.plugin = plugin;
}
 
开发者ID:StuxSoftware,项目名称:SimpleDev,代码行数:4,代码来源:CanaryConfigurationStorage.java

示例9: getInstance

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
/**
 *
 * @return {@link Main#plugin}
 */
public static Plugin getInstance() {
    return Main.plugin;
}
 
开发者ID:Blockhaus2000,项目名称:InternalPluginManager,代码行数:8,代码来源:Main.java

示例10: CanaryCommandHandler

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
/**
 * The Constructor for base-commands.
 *
 * @param plugin The backend that uses this library.
 */
public CanaryCommandHandler(Plugin plugin) {
    super(new CanaryPluginBackend(plugin));
}
 
开发者ID:StuxSoftware,项目名称:SimpleDev,代码行数:9,代码来源:CanaryCommandHandler.java

示例11: CanaryPluginBackend

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
/**
 * Creates a new handle.
 *
 * @param handle The handle in the backend.
 */
protected CanaryPluginBackend(Plugin handle) {
    super(handle);
    this.scheduler = new FallbackSchedulerBackend();
}
 
开发者ID:StuxSoftware,项目名称:SimpleDev,代码行数:10,代码来源:CanaryPluginBackend.java

示例12: CanaryConfigurationLoader

import net.canarymod.plugin.Plugin; //导入依赖的package包/类
/**
 * Uses the default parameters for the configuration loader.
 *
 * @param plugin The plugin that the logger should use.
 */
public CanaryConfigurationLoader(Plugin plugin) {
    super(new CanaryConfigurationStorage(plugin));
    this.setLoggingInterface(new Log4jBinding(plugin.getLogman()));
}
 
开发者ID:StuxSoftware,项目名称:SimpleDev,代码行数:10,代码来源:CanaryConfigurationLoader.java


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