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


Java PluginDescriptionFile.isDatabaseEnabled方法代码示例

本文整理汇总了Java中org.bukkit.plugin.PluginDescriptionFile.isDatabaseEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java PluginDescriptionFile.isDatabaseEnabled方法的具体用法?Java PluginDescriptionFile.isDatabaseEnabled怎么用?Java PluginDescriptionFile.isDatabaseEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.plugin.PluginDescriptionFile的用法示例。


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

示例1: init

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
    this.loader = loader;
    this.server = server;
    this.file = file;
    this.description = description;
    this.dataFolder = dataFolder;
    this.classLoader = classLoader;
    this.configFile = new File(dataFolder, "config.yml");
    this.logger = new PluginLogger(this);

    if (description.isDatabaseEnabled()) {
        ServerConfig db = new ServerConfig();

        db.setDefaultServer(false);
        db.setRegister(false);
        db.setClasses(getDatabaseClasses());
        db.setName(description.getName());
        server.configureDbConfig(db);

        DataSourceConfig ds = db.getDataSourceConfig();

        ds.setUrl(replaceDatabaseString(ds.getUrl()));
        dataFolder.mkdirs();

        ClassLoader previous = Thread.currentThread().getContextClassLoader();

        Thread.currentThread().setContextClassLoader(classLoader);
        ebean = EbeanServerFactory.create(db);
        Thread.currentThread().setContextClassLoader(previous);
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:32,代码来源:JavaPlugin.java

示例2: initialize

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
/**
 * Initializes this plugin with the given variables.
 * <p>
 * This method should never be called manually.
 *
 * @param loader PluginLoader that is responsible for this plugin
 * @param server Server instance that is running this plugin
 * @param description PluginDescriptionFile containing metadata on this plugin
 * @param dataFolder Folder containing the plugin's data
 * @param file File containing this plugin
 * @param classLoader ClassLoader which holds this plugin
 */
protected final void initialize(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
    if (!initialized) {
        this.initialized = true;
        this.loader = loader;
        this.server = server;
        this.file = file;
        this.description = description;
        this.dataFolder = dataFolder;
        this.classLoader = classLoader;
        this.configFile = new File(dataFolder, "config.yml");
        this.logger = new PluginLogger(this);

        if (description.isDatabaseEnabled()) {
            ServerConfig db = new ServerConfig();

            db.setDefaultServer(false);
            db.setRegister(false);
            db.setClasses(getDatabaseClasses());
            db.setName(description.getName());
            server.configureDbConfig(db);

            DataSourceConfig ds = db.getDataSourceConfig();

            ds.setUrl(replaceDatabaseString(ds.getUrl()));
            dataFolder.mkdirs();

            ClassLoader previous = Thread.currentThread().getContextClassLoader();

            Thread.currentThread().setContextClassLoader(classLoader);
            ebean = EbeanServerFactory.create(db);
            Thread.currentThread().setContextClassLoader(previous);
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-API,代码行数:47,代码来源:JavaPlugin.java


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