• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PluginLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initialize

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
/**
 * Initializes this plugin with the given variables.
 *
 * 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.config = YamlConfiguration.loadConfiguration(new File(dataFolder, "config.yml"));

    }
}
 
开发者ID:cyberlis,项目名称:pploader,代码行数:28,代码来源:PythonPlugin.java


示例2: test_default_modules

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Test
public void test_default_modules() throws Exception
{
    PluginLoader loader = mock(PluginLoader.class);
    Server server = mock(Server.class);
    PluginDescriptionFile pdf = mock(PluginDescriptionFile.class);
    File file1 = new File("target" + File.separator + "testdatafolder");

    PluginLogger logger = mock(PluginLogger.class);
    when(server.getLogger()).thenReturn(logger);

    TestPluginDefaultModules plugin = new TestPluginDefaultModules(loader, server, pdf, file1, file1);
    assertThat(plugin.injectedPlugin).isNull();

    plugin.onLoad();
    assertThat(plugin.injectedPlugin).isNull();

    plugin.onEnable();
    assertThat(plugin.injectedPlugin).isSameAs(plugin);
}
 
开发者ID:Eluinhost,项目名称:pluginframework,代码行数:21,代码来源:FrameworkJavaPluginTest.java


示例3: test_extra_modules

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Test
public void test_extra_modules() throws Exception
{
    PluginLoader loader = mock(PluginLoader.class);
    Server server = mock(Server.class);
    PluginDescriptionFile pdf = mock(PluginDescriptionFile.class);
    File file1 = new File("target" + File.separator + "testdatafolder");

    PluginLogger logger = mock(PluginLogger.class);
    when(server.getLogger()).thenReturn(logger);

    TestPluginExtraModules plugin = new TestPluginExtraModules(loader, server, pdf, file1, file1);
    assertThat(plugin.i).isNull();

    plugin.onLoad();
    assertThat(plugin.i).isNull();

    plugin.onEnable();
    assertThat(plugin.i).isInstanceOf(TestPluginExtraModules.TestConcrete.class);
}
 
开发者ID:Eluinhost,项目名称:pluginframework,代码行数:21,代码来源:FrameworkJavaPluginTest.java


示例4: test_override_modules

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Test
public void test_override_modules() throws Exception
{
    PluginLoader loader = mock(PluginLoader.class);
    Server server = mock(Server.class);
    PluginDescriptionFile pdf = mock(PluginDescriptionFile.class);
    File file1 = new File("target" + File.separator + "testdatafolder");

    PluginLogger logger = mock(PluginLogger.class);
    when(server.getLogger()).thenReturn(logger);

    TestPluginReplaceModules plugin = new TestPluginReplaceModules(loader, server, pdf, file1, file1);
    assertThat(plugin.logger).isNull();

    plugin.onLoad();
    assertThat(plugin.logger).isNull();

    plugin.onEnable();
    assertThat(plugin.logger).isInstanceOf(TestPluginReplaceModules.TestPluginLogger.class);
}
 
开发者ID:Eluinhost,项目名称:pluginframework,代码行数:21,代码来源:FrameworkJavaPluginTest.java


示例5: JavaPlugin

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
/**
 * @deprecated This method is intended for unit testing purposes when the
 *     other {@linkplain #JavaPlugin(JavaPluginLoader,
 *     PluginDescriptionFile, File, File) constructor} cannot be used.
 *     <p>
 *     Its existence may be temporary.
 */
@Deprecated
protected JavaPlugin(final PluginLoader loader, final Server server, final PluginDescriptionFile description, final File dataFolder, final File file) {
    final ClassLoader classLoader = this.getClass().getClassLoader();
    if (classLoader instanceof PluginClassLoader) {
        throw new IllegalStateException("Cannot use initialization constructor at runtime");
    }
    init(loader, server, description, dataFolder, file, classLoader);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:16,代码来源:JavaPlugin.java


示例6: initialize

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
/**
 * @deprecated This method is legacy and will be removed - it must be
 *     replaced by the specially provided constructor(s).
 */
@Deprecated
protected final void initialize(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
    if (server.getWarningState() == WarningState.OFF) {
        return;
    }
    getLogger().log(Level.WARNING, getClass().getName() + " is already initialized", server.getWarningState() == WarningState.DEFAULT ? null : new AuthorNagException("Explicit initialization"));
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:12,代码来源:JavaPlugin.java


示例7: init

import org.bukkit.plugin.PluginLoader; //导入依赖的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


示例8: test_no_modules

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Test
public void test_no_modules() throws Exception
{
    PluginLoader loader = mock(PluginLoader.class);
    Server server = mock(Server.class);
    PluginDescriptionFile pdf = mock(PluginDescriptionFile.class);
    File file1 = new File("target" + File.separator + "testdatafolder");

    PluginLogger logger = mock(PluginLogger.class);
    when(server.getLogger()).thenReturn(logger);

    TestPluginNoModules plugin = new TestPluginNoModules(loader, server, pdf, file1, file1);
    plugin.onLoad();
    plugin.onEnable();
}
 
开发者ID:Eluinhost,项目名称:pluginframework,代码行数:16,代码来源:FrameworkJavaPluginTest.java


示例9: initialize

import org.bukkit.plugin.PluginLoader; //导入依赖的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


示例10: registerInterface

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:PluginManagerMock.java


示例11: registerInterface

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public void registerInterface(Class<? extends PluginLoader> loader)
        throws IllegalArgumentException {
    delegate.registerInterface(loader);
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:6,代码来源:LoggedPluginManager.java


示例12: before

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@SuppressWarnings({"resource", "deprecation"})
	@Before
	public void before() throws Exception {
		
		final File dataDir = new File("target/classes/");
		final File jar = new File("target/", "skript.jar");
		assumeTrue(jar.exists());
		
		final Logger l = Logger.getLogger(getClass().getCanonicalName());
		l.setParent(SkriptLogger.LOGGER);
		l.setLevel(Level.WARNING);
		
		final Server s = createMock(Server.class);
		s.getLogger();
		expectLastCall().andReturn(l).anyTimes();
		s.isPrimaryThread();
		expectLastCall().andReturn(true).anyTimes();
		s.getName();
		expectLastCall().andReturn("Whatever").anyTimes();
		s.getVersion();
		expectLastCall().andReturn("2.0").anyTimes();
		s.getBukkitVersion();
		expectLastCall().andReturn("2.0").anyTimes();
		replay(s);
		
		Bukkit.setServer(s);
		
		final Skript skript = (Skript) ObjenesisHelper.newInstance(Skript.class); // bypass the class loader check
		final Field instance = Skript.class.getDeclaredField("instance");
		instance.setAccessible(true);
		instance.set(null, skript);
		
		final PluginDescriptionFile pdf = new PluginDescriptionFile(new FileInputStream(new File(dataDir, "plugin.yml")));
		
//	    final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
		final Method init = JavaPlugin.class.getDeclaredMethod("init", PluginLoader.class, Server.class, PluginDescriptionFile.class, File.class, File.class, ClassLoader.class);
		init.setAccessible(true);
		init.invoke(skript, new JavaPluginLoader(s), s, pdf, dataDir, jar, getClass().getClassLoader());
		
		Skript.getAddonInstance().loadClasses("ch.njol.skript", "entity");
		new JavaClasses();
		new BukkitClasses();
		new BukkitEventValues();
		new SkriptClasses();
		
		final Field r = Skript.class.getDeclaredField("acceptRegistrations");
		r.setAccessible(true);
		r.set(null, false);
		Classes.onRegistrationsStop();
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:51,代码来源:ClassesTest.java


示例13: registerInterface

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException {
	pm.registerInterface(loader);
}
 
开发者ID:DonkeyCore,项目名称:MinigameManager,代码行数:5,代码来源:MinigamePluginManagerWrapper.java


示例14: setLoader

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
void setLoader(PluginLoader loader) {
    this.loader = loader;
}
 
开发者ID:caoli5288,项目名称:economy,代码行数:4,代码来源:SubPlugin.java


示例15: getPluginLoader

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public PluginLoader getPluginLoader() {
    return loader;
}
 
开发者ID:caoli5288,项目名称:economy,代码行数:5,代码来源:SubPlugin.java


示例16: getPluginLoader

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public PluginLoader getPluginLoader() {
    return delegate.getPluginLoader();
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:5,代码来源:BootstrapedPlugin.java


示例17: getPluginLoader

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public PluginLoader getPluginLoader() {
	return plugin.getPluginLoader();
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:5,代码来源:ExilePearlCore.java


示例18: registerInterface

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException { }
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:3,代码来源:TestPluginManager.java


示例19: getPluginLoader

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
public PluginLoader getPluginLoader() {
	return pluginLoader;
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:4,代码来源:TestServer.java


示例20: registerInterface

import org.bukkit.plugin.PluginLoader; //导入依赖的package包/类
@Override
public void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException {
	throw Pokkit.unsupported();

}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:6,代码来源:PokkitPluginManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlugInFilterRunner类代码示例发布时间:2022-05-21
下一篇:
Java MemberOrder类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap