-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a8190c0
Showing
15 changed files
with
731 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/discord.xml | ||
.idea/gradle.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# Plugin Annotation Processor | ||
|
||
|
||
A Bukkit/Spigot or BungeeCord plugin that simplifies the generation of `plugin.yml` file using annotations. | ||
|
||
## Overview | ||
|
||
This tool provides a convenient way to generate the `plugin.yml` file for your Spigot/Paper/BungeeCord/Waterfall plugin. | ||
It utilizes annotations to define essential information directly in your code. | ||
|
||
## Prerequisites | ||
- Java 8 or higher | ||
- Bukkit/Spigot/Paper latest recommended but should work down to 1.7 | ||
- BungeeCord/Waterfall latest - it supports down to MC 1.8 as of 2023 | ||
|
||
## Features | ||
- **Annotation-based Configuration**: Use the `@Plugin` and `@BungeePlugin` annotations to define plugin information directly in your Java/Kotlin code. | ||
- **Cross-Compatibility**: Works with Bukkit, Spigot, Paper, BungeeCord, and Waterfall. | ||
- **Versioning**: Version number is derived from the Gradle/Maven project version. (Optional) | ||
|
||
--- | ||
## Usage | ||
|
||
### Bukkit/Spigot/Paper | ||
(This example does not show all properties) | ||
```java | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import de.itsTyrion.pluginAnnotation.Plugin; | ||
|
||
@Plugin( | ||
name = "MyPlugin", | ||
description = "Awesome Bukkit plugin", | ||
authors = {"Your Name"}, | ||
depend = {"aDependency"} | ||
) | ||
public class MyPlugin extends JavaPlugin { | ||
// Your plugin code here | ||
} | ||
``` | ||
|
||
### BungeeCord/Waterfall | ||
```java | ||
import net.md_5.bungee.api.plugin.Plugin; | ||
|
||
import de.itsTyrion.pluginAnnotation.BungeePlugin; | ||
|
||
@Plugin( | ||
name = "MyPlugin", | ||
description = "Awesome Bungee/Waterfall plugin", | ||
author = "Your Name", | ||
depends = {"aDependency"} | ||
) | ||
public class MyBungeePlugin extends Plugin { | ||
// Your plugin code here | ||
} | ||
``` | ||
|
||
## Gradle | ||
#### For Java sources: | ||
```groovy | ||
dependencies { | ||
// Add your other dependencies here | ||
compileOnly 'de.itsTyrion:PluginAnnotationProcessor:1.0' | ||
annotationProcessor 'de.itsTyrion:PluginAnnotationProcessor:1.0' | ||
} | ||
tasks.withType(JavaCompile).configureEach { | ||
// Add your other options here | ||
options.compilerArgs += ('-Aproject.version=' + project.version) | ||
} | ||
``` | ||
#### For Kotlin sources: | ||
```groovy | ||
plugins { | ||
// Add your other gradle plugins here | ||
id 'org.jetbrains.kotlin.kapt' version 'current.kotlin.version' | ||
} | ||
dependencies { | ||
// Add your other dependencies here | ||
compileOnly 'de.itsTyrion:PluginAnnotationProcessor:1.0' | ||
kapt 'de.itsTyrion:PluginAnnotationProcessor:1.0' | ||
} | ||
kapt { | ||
arguments { | ||
// Add other annotation processor arguments if needed | ||
arg('project.version', project.version) | ||
} | ||
} | ||
``` | ||
|
||
## Maven | ||
#### For Java sources: | ||
```xml | ||
<dependency> | ||
<groupId>de.itsTyrion</groupId> | ||
<artifactId>PluginAnnotationProcessor</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
``` | ||
```xml | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> | ||
<configuration> | ||
<source>17</source> | ||
<target>17</target> | ||
<!-- Pass the project version as an argument to the compiler --> | ||
<compilerArgs> | ||
<arg>-Aproject.version=${project.version}</arg> | ||
</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
``` | ||
#### For Kotlin sources (I recommend you use Gradle): | ||
(Copied from [the docs](https://kotlinlang.org/docs/kapt.html#use-in-maven)) | ||
Add an execution of the kapt goal from kotlin-maven-plugin before compile: | ||
```xml | ||
<execution> | ||
<id>kapt</id> | ||
<goals> | ||
<goal>kapt</goal> <!-- You can skip the <goals> element | ||
if you enable extensions for the plugin --> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<sourceDir>src/main/kotlin</sourceDir> | ||
<sourceDir>src/main/java</sourceDir> | ||
</sourceDirs> | ||
<annotationProcessorPaths> | ||
<annotationProcessorPath> | ||
<groupId>de.itsTyrion</groupId> | ||
<artifactId>PluginAnnotationProcessor</artifactId> | ||
<version>1.0</version> | ||
</annotationProcessorPath> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</execution> | ||
``` | ||
|
||
## Contributing | ||
Feel free to contribute to the development of this plugin by opening issues or submitting pull requests. | ||
|
||
## API Reference | ||
Just add it to the plugin's main class | ||
Parameter names match plugin.yml/bungee.yml | ||
|
||
## License | ||
This project is licensed under the MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
group 'de.itsTyrion' | ||
version '1.0' | ||
|
||
dependencies { | ||
implementation 'javax.annotation:javax.annotation-api:1.3.2' | ||
compileOnly 'org.projectlombok:lombok:1.18.30' | ||
} | ||
|
||
compileJava { | ||
options.encoding = 'UTF-8' | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = sourceCompatibility | ||
options.annotationProcessorPath = classpath | ||
} | ||
|
||
jar { | ||
from 'build/classes/java/main' | ||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Nov 22 17:03:32 CET 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.