Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
itsTyrion committed Nov 23, 2023
0 parents commit a8190c0
Show file tree
Hide file tree
Showing 15 changed files with 731 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
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
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions README.md
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.
36 changes: 36 additions & 0 deletions build.gradle
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 added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
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
Loading

0 comments on commit a8190c0

Please sign in to comment.