當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。