org.spongepowered.api.plugin.Plugin类的使用及代码示例

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

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

Plugin介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

@Plugin(id = SpongeWorldEdit.MOD_ID, name = "WorldEdit",
    description = "WorldEdit is an easy-to-use in-game world editor for Minecraft",
    url = "http://www.enginehub.org/worldedit")

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

@SuppressWarnings("deprecation")
void apply(Messager messager) {
  String value = this.annotation.get().id();
  if (!ID_PATTERN.matcher(value).matches()) {
    messager.printMessage(ERROR, "Plugin ID '" + value + "' must match pattern '" + ID_PATTERN.pattern() + "'. "
  value = this.annotation.get().name();
  if (value.isEmpty()) {
    if (this.metadata.getName() == null) {
  value = this.annotation.get().version();
  if (value.isEmpty()) {
    if (this.metadata.getVersion() == null) {
  value = this.annotation.get().description();
  if (value.isEmpty()) {
    if (this.metadata.getDescription() == null) {
  value = this.annotation.get().url();
  if (!value.isEmpty()) {
    if (!isLikelyValidUrl(value)) {
  String[] authors = this.annotation.get().authors();
  if (authors.length > 0) {
    this.metadata.getAuthors().clear();
  Dependency[] dependencies = this.annotation.get().dependencies();
  if (dependencies.length > 0) {
    for (Dependency dependency : dependencies) {

代码示例来源:origin: lucko/spark

@Override
public String getVersion() {
  return SparkSpongePlugin.class.getAnnotation(Plugin.class).version();
}

代码示例来源: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: Rsl1122/Plan-PlayerAnalytics

@Override
public String getVersion() {
  return getClass().getAnnotation(Plugin.class).version();
}

代码示例来源:origin: NucleusPowered/Nucleus

@Plugin(id = NucleusAPITokens.ID, name = NucleusAPITokens.NAME, version = NucleusAPITokens.VERSION, description = NucleusAPITokens.DESCRIPTION)
public final class NucleusAPIMod {

  private final Logger logger;

  @Inject
  public NucleusAPIMod(Logger logger) {
    this.logger = logger;
  }

  @Listener
  public void onPreInit(GamePreInitializationEvent event) {
    this.logger.info("Loading " + NucleusAPITokens.NAME + " for Nucleus version " + NucleusAPITokens.VERSION);
    NucleusAPITokens.onPreInit(this);
  }
}

代码示例来源:origin: BuycraftPlugin/BuycraftX

@Override
public String getPluginVersion() {
  return plugin.getClass().getAnnotation(Plugin.class).version();
}

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "pluginmixintest", name = "PluginMixinTest", version = "0.3", description = "A mixin test plugin.")
public class PluginMixinTestPlugin {

}

代码示例来源:origin: BuycraftPlugin/BuycraftX

String curVersion = getClass().getAnnotation(Plugin.class).version();

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "ca_sapon_smite",
    name = "Smite",
    version = "1.1",

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "schedulertest", name = "SchedulerTest", version = "1.2", description = "A plugin to showcase the scheduler.")
public class SchedulerTest {

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "flardians", name = "Flardians", version = "0.5", description = "BUY FLARD HERE")
public class Flardians {

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

@Plugin(id = "GreatmancodeToolsLoader", name = "GreatmancodeToolsLoader", version = "1.0")
public class SpongeLoader implements Loader {

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "myhomes", name = "MyHomes", version = "1.2", description = "An example of the data API.")
public class MyHomes {

代码示例来源:origin: games647/ChangeSkin

@Singleton
@Plugin(id = ARTIFACT_ID, name = PomData.NAME, version = PomData.VERSION,
    url = PomData.URL, description = PomData.DESCRIPTION)
public class ChangeSkinSponge implements PlatformPlugin<CommandSource> {

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "simplefireball",
    name = "SimpleFireball",
    version = "1.2",

代码示例来源:origin: Matsv/ViaBackwards

@Plugin(id = "viabackwards",
    name = "ViaBackwards",
    version = VersionInfo.VERSION,
    authors = {"Matsv"},
    description = "Allow older Minecraft versions to connect to an newer server version.",
    dependencies = {@Dependency(id = "viaversion")}
)
public class SpongePlugin implements ViaBackwardsPlatform {
  @Getter
  private Logger logger;
  @Inject
  private org.slf4j.Logger loggerSlf4j;

  @Listener(order = Order.LATE)
  public void onGameStart(GameInitializationEvent e) {
    // Setup Logger
    this.logger = new LoggerWrapper(loggerSlf4j);
    // Init!
    this.init();
  }

  @Override
  public void disable() {
    // Not possible
  }
}

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = "sponge_test_suite", name = "TestSuite", version = "0.4", description = "Runtime test suite for sponge implementations")
public class TestSuite {

代码示例来源:origin: SpongePowered/Cookbook

@Plugin(id = WorldsTest.PLUGIN_ID, name = "WorldsTest", version = "0.4", description = "A plugin to test various world API.")
public class WorldsTest {

代码示例来源:origin: CodeCrafter47/BungeeTabListPlus

@Plugin(id = "bungeetablistplus", name = "BungeeTabListPlus-SpongeBridge", version = PomData.VERSION)
public class SpongePlugin extends BungeeTabListPlusSpongeAPI {

相关文章