Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b35094d27 |
No files matched your search
@@ -3,16 +3,11 @@ plugins {
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("net.kyori:adventure-api:4.11.0")
|
||||
compileOnly("net.kyori:adventure-text-minimessage:4.11.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-legacy:4.11.0")
|
||||
compileOnly(project(":miniplaceholders-connect"))
|
||||
implementation("com.google.code.gson:gson:2.9.1")
|
||||
testImplementation(platform("org.junit:junit-bom:5.8.1"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testImplementation("net.kyori:adventure-api:4.11.0")
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package me.dreamerzero.miniplaceholders.api.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import me.dreamerzero.miniplaceholders.api.enums.Platform;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Extension {
|
||||
String name();
|
||||
|
||||
Platform[] platform();
|
||||
|
||||
String version() default "";
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package me.dreamerzero.miniplaceholders.api.annotation.processor;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import javax.annotation.processing.AbstractProcessor;
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
import javax.lang.model.element.Name;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
import me.dreamerzero.miniplaceholders.api.annotation.Extension;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
|
||||
@SupportedAnnotationTypes({"me.dreamerzero.miniplaceholders.api.annotation.Extension"})
|
||||
public class ExtensionAnnotationProcessor extends AbstractProcessor {
|
||||
private ProcessingEnvironment environment;
|
||||
|
||||
@Override
|
||||
public synchronized void init(ProcessingEnvironment processingEnv) {
|
||||
this.environment = processingEnv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
if (roundEnv.processingOver()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) {
|
||||
if (element.getKind() != ElementKind.CLASS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Extension extension = element.getAnnotation(Extension.class);
|
||||
Name name = ((TypeElement) element).getQualifiedName();
|
||||
|
||||
try {
|
||||
FileObject object = environment.getFiler()
|
||||
.createResource(StandardLocation.CLASS_OUTPUT, "", "miniplaceholders-extension.json");
|
||||
try (Writer writer = new BufferedWriter(object.openWriter())) {
|
||||
new Gson().toJson(new ProcessedExtension(
|
||||
extension.name(),
|
||||
extension.version(),
|
||||
name.toString(),
|
||||
extension.platform()),
|
||||
writer);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
environment.getMessager().printMessage(Diagnostic.Kind.ERROR, "Cannot generate extension file");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package me.dreamerzero.miniplaceholders.api.annotation.processor;
|
||||
|
||||
import me.dreamerzero.miniplaceholders.api.enums.Platform;
|
||||
|
||||
public final class ProcessedExtension {
|
||||
private final String name;
|
||||
private final String version;
|
||||
private final Platform[] platforms;
|
||||
private final String clazz;
|
||||
|
||||
ProcessedExtension(String name, String version, String clazz, Platform... platforms) {
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
this.platforms = platforms;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public Platform[] getPlatforms() {
|
||||
return platforms;
|
||||
}
|
||||
public String getClazz() {
|
||||
return this.clazz;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
module me.dreamerzero.miniplaceholders.api {
|
||||
/** MiniPlaceholdes API Module */
|
||||
open module me.dreamerzero.miniplaceholders.api {
|
||||
requires net.kyori.adventure;
|
||||
requires net.kyori.examination.api;
|
||||
requires net.kyori.adventure.text.minimessage;
|
||||
requires static org.jetbrains.annotations;
|
||||
requires me.dreamerzero.miniplaceholders.connect;
|
||||
requires java.base;
|
||||
requires java.compiler;
|
||||
requires com.google.gson;
|
||||
|
||||
exports me.dreamerzero.miniplaceholders.api;
|
||||
exports me.dreamerzero.miniplaceholders.api.enums;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
me.dreamerzero.miniplaceholders.api.annotation.processor.ExtensionAnnotationProcessor
|
||||
+3
-9
@@ -6,14 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "java")
|
||||
group = "me.dreamerzero.miniplaceholders"
|
||||
version = "1.2.0"
|
||||
description = "MiniPlaceholders"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
apply<JavaPlugin>()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -26,6 +19,7 @@ dependencies {
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://repo.maven.apache.org/maven2/")
|
||||
}
|
||||
@@ -33,7 +27,7 @@ subprojects {
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
archiveFileName.set("MiniPlaceholders.jar")
|
||||
archiveFileName.set("MiniPlaceholders-$version.jar")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations = listOf(project.configurations.shadow.get())
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ dependencies {
|
||||
compileOnly("com.mojang:brigadier:1.0.18")
|
||||
}
|
||||
|
||||
blossom {
|
||||
replaceToken("{version}", version)
|
||||
blossom{
|
||||
replaceToken("{version}", project.version)
|
||||
replaceTokenIn("src/main/java/me/dreamerzero/miniplaceholders/common/PluginConstants.java")
|
||||
}
|
||||
|
||||
@@ -24,4 +24,10 @@ tasks {
|
||||
|
||||
options.release.set(17)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes("Automatic-Module-Name" to "me.dreamerzero.miniplaceholders.common")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package me.dreamerzero.miniplaceholders.extension;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.dreamerzero.miniplaceholders.api.annotation.Extension;
|
||||
|
||||
public final class Loader {
|
||||
private Loader() {}
|
||||
public static Extension[] loadExtensions(Path extensionsPath) {
|
||||
List<Extension> extensions = new ArrayList<>();
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(extensionsPath, (file) -> file.toString().endsWith(".jar"))) {
|
||||
for (Path ext : stream) {
|
||||
|
||||
}
|
||||
} catch(IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
module me.dreamerzero.miniplaceholders.connect {
|
||||
//TODO: exports to
|
||||
exports me.dreamerzero.miniplaceholders.connect;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
group = me.dreamerzero.miniplaceholders
|
||||
version = 1.2.1
|
||||
description = MiniPlaceholders
|
||||
@@ -11,15 +11,13 @@ dependencies {
|
||||
paperDevBundle("1.19.1-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
val pluginVersion: String = version as String
|
||||
|
||||
bukkit {
|
||||
name = "MiniPlaceholders"
|
||||
main = "me.dreamerzero.miniplaceholders.paper.PaperPlugin"
|
||||
apiVersion = "1.18"
|
||||
website = "https://github.com/4drian3d/MiniPlaceholders"
|
||||
authors = listOf("4drian3d")
|
||||
version = pluginVersion
|
||||
version = project.version as String
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
@@ -36,5 +34,10 @@ tasks {
|
||||
runServer {
|
||||
minecraftVersion("1.19.1")
|
||||
}
|
||||
jar {
|
||||
manifest {
|
||||
attributes("Automatic-Module-Name" to "me.dreamerzero.miniplaceholders.paper")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,16 @@ dependencies {
|
||||
|
||||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
|
||||
tasks.compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
tasks {
|
||||
compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
|
||||
options.release.set(17)
|
||||
}
|
||||
options.release.set(17)
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes("Automatic-Module-Name" to "me.dreamerzero.miniplaceholders.velocity")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user