mirror of
https://hub.spigotmc.org/stash/scm/spigot/plugin-annotations.git
synced 2025-08-05 16:48:43 +00:00
#12: Migrate to using a String for ApiVersion since semantic versioning is now supported
This commit is contained in:
parent
ae54046503
commit
7ddb5d0026
3 changed files with 9 additions and 68 deletions
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>plugin-annotations</artifactId>
|
||||
<version>1.2.3-SNAPSHOT</version>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Plugin Annotations</name>
|
||||
|
|
|
@ -233,8 +233,8 @@ public class PluginAnnotationProcessor extends AbstractProcessor {
|
|||
// api-version
|
||||
if ( mainPluginType.getAnnotation( ApiVersion.class ) != null ) {
|
||||
ApiVersion apiVersion = mainPluginType.getAnnotation( ApiVersion.class );
|
||||
if ( apiVersion.value() != ApiVersion.Target.DEFAULT ) {
|
||||
yml.put( "api-version", apiVersion.value().getVersion() );
|
||||
if ( apiVersion.value() != null ) {
|
||||
yml.put( "api-version", apiVersion.value() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,76 +9,17 @@ import java.lang.annotation.Target;
|
|||
/**
|
||||
* This annotation specifies the api version of the plugin.
|
||||
* <br>
|
||||
* Defaults to {@link ApiVersion.Target#DEFAULT}.
|
||||
* <br>
|
||||
* Pre-1.13 plugins do not need to use this annotation.
|
||||
* <br>
|
||||
* 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20 are the available versions.
|
||||
* <br>
|
||||
* This doesn't include the minor version until 1.20.5. From 1.20.5 and onward,
|
||||
* a minor version is supported.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target( ElementType.TYPE )
|
||||
public @interface ApiVersion {
|
||||
|
||||
Target value() default Target.DEFAULT;
|
||||
|
||||
/**
|
||||
* Specifies the target api-version for this plugin.
|
||||
*
|
||||
* All pre-1.13 plugins must use {@link #DEFAULT}.
|
||||
*/
|
||||
public static enum Target {
|
||||
/**
|
||||
* This target version specifies that the plugin was made for pre-1.13 Spigot versions.
|
||||
*/
|
||||
DEFAULT( null ),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.13+ versions in mind.
|
||||
*/
|
||||
v1_13( "1.13" ),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.14+ versions in mind.
|
||||
*/
|
||||
v1_14( "1.14" ),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.15+ versions in mind.
|
||||
*/
|
||||
v1_15( "1.15" ),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.16+ versions in mind.
|
||||
*/
|
||||
v1_16("1.16"),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.17+ versions in mind.
|
||||
*/
|
||||
v1_17("1.17"),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.18+ versions in mind.
|
||||
*/
|
||||
v1_18("1.18"),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.19+ versions in mind.
|
||||
*/
|
||||
v1_19("1.19"),
|
||||
|
||||
/**
|
||||
* This target version specifies that the plugin was made with 1.20+ versions in mind.
|
||||
*/
|
||||
v1_20("1.20");
|
||||
|
||||
private final String version;
|
||||
|
||||
private Target(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
String value();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue