org.spongepowered.api.plugin.Plugin.name()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.spongepowered.api.plugin.Plugin.name()方法的一些代码示例,展示了Plugin.name()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.name()方法的具体详情如下:
包路径:org.spongepowered.api.plugin.Plugin
类名称:Plugin
方法名:name

Plugin.name介绍

暂无

代码示例

代码示例来源:origin: com.greatmancode/tools

@Override
public void onEnable() {
  SpongeServerCaller serverCaller = new SpongeServerCaller(this, getClass().getAnnotation(Plugin.class).name(), getClass().getAnnotation(Plugin.class).version());
  eventManager = new EventManager(serverCaller);
  InputStream is = this.getClass().getResourceAsStream("/loader.yml");
  BufferedReader br = new BufferedReader(new InputStreamReader(is));
  try {
    String mainClass = br.readLine();
    mainClass = mainClass.split("main-class:")[1].trim();
    Class<?> clazz = Class.forName(mainClass);
    if (Common.class.isAssignableFrom(clazz)) {
      common = (Common) clazz.newInstance();
      common.onEnable(serverCaller, serverCaller.getLogger());
      //Since it's sponge, we need a bit more data to be able to load properly.
      String name = br.readLine().split("name:")[1].trim();
      String version = br.readLine().split("version:")[1].trim();
      //SpongeMod.instance.registerPluginContainer(new SpongePluginContainer(name, name, version, common), name, common); //TODO Fix that
    } else {
      serverCaller.getLogger().severe("The class " + mainClass + " is invalid!");
    }
  } catch (IOException e) {
    serverCaller.getLogger().log(Level.SEVERE, "Unable to load the main class!", e);
  } catch (ClassNotFoundException e) {
    serverCaller.getLogger().log(Level.SEVERE, "Unable to load the main class!", e);
  } catch (InstantiationException e) {
    serverCaller.getLogger().log(Level.SEVERE, "Unable to load the main class!", e);
  } catch (IllegalAccessException e) {
    serverCaller.getLogger().log(Level.SEVERE, "Unable to load the main class!", e);
  }
}

代码示例来源:origin: org.spongepowered/spongeapi

value = this.annotation.get().name();
if (value.isEmpty()) {
  if (this.metadata.getName() == null) {

相关文章

微信公众号

最新文章

更多