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


Java Plugin类代码示例

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


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

示例1: onServerInitialization

import org.spongepowered.api.plugin.Plugin; //导入依赖的package包/类
@Listener
  public void onServerInitialization(GamePreInitializationEvent  event) {
      instance = this;
      log(Level.INFO, "Initializing NamelessMC " + getClass().getAnnotation(Plugin.class).version());
      
      // Luckperms Check
      if(game.getPluginManager().isLoaded("luckperms")) {
      	permissions = new LuckPerms();
      }
      
      // Economy Service Initliazation
      Optional<EconomyService> eopt = game.getServiceManager().provide(EconomyService.class);
      if (eopt.isPresent()) {
      	System.out.println("economy works");
      	economy = eopt.get();
      }
      
      // Initialize Configuration
      
      try {
	Config.initialize();
} catch (IOException e) {
	log(Level.ERROR, "Unable to load config.");
	e.printStackTrace();
	return;
}
	
if (!checkConnection()) return;
      
  }
 
开发者ID:NamelessMC,项目名称:Nameless-Plugin,代码行数:31,代码来源:NamelessPlugin.java

示例2: getPluginName

import org.spongepowered.api.plugin.Plugin; //导入依赖的package包/类
private String getPluginName(Object plugin) {
    if(plugin == null) {
        return null;
    }

    Class pluginClass = plugin.getClass();

    if(pluginClass.isAnnotationPresent(Plugin.class)) {
        Plugin annotation = (Plugin) pluginClass.getAnnotation(Plugin.class);
        return annotation.name();
    }

    return null;
}
 
开发者ID:MrMysteri0us,项目名称:DBManager,代码行数:15,代码来源:DBManager.java

示例3: run

import org.spongepowered.api.plugin.Plugin; //导入依赖的package包/类
@Override
public void run(CommandSource sender, String[] args) {
    sender.sendMessage(Colors.color(I18n.tl("prefix") + " " + I18n.tl("cmd_current_version", plugin.getClass().getAnnotation(Plugin.class).version())));
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:5,代码来源:Version.java

示例4: process

import org.spongepowered.api.plugin.Plugin; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
	if (roundEnv.processingOver()) {
		if (!roundEnv.errorRaised()) {
			finish();
		}
		return true;
	}

	Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(Plugin.class);
	if (elements.size() == 0) {
		return false;
	}

	for (Element e : elements) {
		try {
			if (e.getKind() != ElementKind.CLASS) {
				error("Invalid element of type " + e.getKind() + " annotated with @"
						+ Plugin.class.getSimpleName());
				continue;
			}

			Plugin annotation = e.getAnnotation(Plugin.class);
			String id = annotation.name().toLowerCase();
			if (!plugins.containsKey(id)) {
				plugins.put(id, new OsmiumMetaContainer(((TypeElement) e).getQualifiedName().toString(), // new
						// OsmiumMetaContainer(Class.forName(((TypeElement)
						// e).getQualifiedName().toString()).asSubclass(OsmiumPlugin.class),
						annotation.name(), annotation.version(), annotation.description(), annotation.url(),
						annotation.authors(), annotation.dependencies()));
				info("Generating plugin metafiles for annotation: " + Objects.toClassString(plugins.get(id)));
			} else {
				error("Plugin with id '" + id + "' already exists!");
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}

	}
	return true;
}
 
开发者ID:kmecpp,项目名称:Osmium,代码行数:42,代码来源:OsmiumPluginProcessor.java

示例5: getPluginVersion

import org.spongepowered.api.plugin.Plugin; //导入依赖的package包/类
@Override
public String getPluginVersion() {
    return plugin.getClass().getAnnotation(Plugin.class).version();
}
 
开发者ID:BuycraftPlugin,项目名称:BuycraftX,代码行数:5,代码来源:SpongeBuycraftPlatform.java


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