Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7219

[proposed enhancement] Allow for plugin annotations to be placed elsewhere

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • None
    • N/A - Supports any version
    • Yes

      I'd like to propose the ability to place plugin annotations over package-info.java or anywhere else in the project. I personally (and many people) hate bringing this Java EE mess to Minecraft development where annotations are spammed everywhere but I am also not a fan of having a plugin.yml in the project.

      Here's what I propose - A new parameter for @Plugin of type Class<? extends JavaPlugin> with a default value of JavaPlugin.class, so if it is not provided (ie remains default) we can check where the annotation was declared and use that as the main class instead. Then, annotations can be declared on package-info.java or elsewhere where it would be appropriate as follows:

      @Plugin(name = "Example", version = "1.0", main = ExamplePlugin.class)
      @Description("An example plugin.")
      @LoadOrder(PluginLoadOrder.POSTWORLD)
      @Website("https://example.com/")
      @Author("SpigotMC")
      package com.example.plugin;
      
      // no import statement required as ExamplePlugin is in the same package.

      This way, we could keep things much neater while avoiding crummy YAML configurations.

      Thanks for reading, please tell me where I need to go for these kind of suggestions if I have done this in the wrong place, I am unsure if I should be doing it here.

            Unassigned Unassigned
            jirauser43049 user-53cb8 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: