Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #113 from Shynixn/development
Browse files Browse the repository at this point in the history
Merge changes to master --release
  • Loading branch information
Shynixn authored Jun 9, 2023
2 parents b7f593f + 16fcccf commit f8a2f5a
Show file tree
Hide file tree
Showing 15 changed files with 1,112 additions and 26 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN java -jar BuildTools.jar --rev 1.18.2 --remapped
RUN java -jar BuildTools.jar --rev 1.19 --remapped
RUN java -jar BuildTools.jar --rev 1.19.3 --remapped
RUN java -jar BuildTools.jar --rev 1.19.4 --remapped
RUN java -jar BuildTools.jar --rev 1.20 --remapped

# 3. Build plugin for 1.8 - 1.17 with jdk17
FROM amazoncorretto:17 AS plugin-jdk17
Expand All @@ -46,7 +47,7 @@ RUN ./gradlew build pluginJar --no-daemon
# 4. Launch a minecraft server with jdk17 and plugin
FROM amazoncorretto:17
# Change to the current plugin version present in build.gradle
ENV PLUGIN_VERSION=2.10.0
ENV PLUGIN_VERSION=2.11.0
# Change to the server version you want to test.
ENV SERVER_VERSION=spigot-1.19.4.jar
# Port of the Minecraft Server.
Expand Down
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ StructureBlockLib is a bukkit API and implementation for handling structures on
* API to save or load structures without an actual structure block.
* Asynchronous implementation and API.
* Fluent API.
* Version support 1.9.R1 - 1.19.R3
* Version support 1.9.R1 - 1.20.R1
* Java support 8 - Latest

## Donation

Support development with a small tip :heart: :coffee:.

* Dogecoin Address: ``DAzt6RGAapkhbKD9uFKJgSR5vpfT9nSvKi``

## Installation

1. Include the dependency to StructureBlockLib
Expand All @@ -35,15 +29,15 @@ Support development with a small tip :heart: :coffee:.
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-api</artifactId>
<version>2.10.0</version>
<version>2.11.0</version>
<scope>provided</scope>
</dependency>
```
**Gradle**

```xml
dependencies {
compileOnly("com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.10.0")
compileOnly("com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.11.0")
}
```

Expand Down Expand Up @@ -277,8 +271,8 @@ structureBlock.update();
**plugin.yml**
```yaml
libraries:
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.10.0
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.10.0
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.11.0
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.11.0
```
### For version < 1.17
Expand All @@ -297,22 +291,22 @@ go with the option above instead. There are several tutorials on spigotmc.org.
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-api</artifactId>
<version>2.10.0</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-core</artifactId>
<version>2.10.0</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
```
**Gradle**

```xml
dependencies {
implementation("com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.10.0")
implementation("com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.10.0")
implementation("com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.11.0")
implementation("com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.11.0")
}
```

Expand All @@ -322,7 +316,7 @@ dependencies {

* Install Java 17 or higher
* Fork the StructureBlockLib project on github and clone it to your local environment.
* StructureBlockLib requires spigot server implementations from 1.9.4 to 1.18.2 to be correctly installed in your local Maven cache.
* StructureBlockLib requires spigot server implementations from 1.9.4 to 1.20 to be correctly installed in your local Maven cache.
As this requires multiple java version to build different versions, a Dockerfile is provided to build these dependencies in a docker container
and then copy it to your local Maven cache.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tasks.register("printVersion") {

subprojects {
group 'com.github.shynixn.structureblocklib'
version '2.10.0'
version '2.11.0'

apply plugin: 'kotlin-platform-jvm'
apply plugin: 'signing'
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ include("structureblocklib-bukkit-core:bukkit-nms-118R2")
include("structureblocklib-bukkit-core:bukkit-nms-119R1")
include("structureblocklib-bukkit-core:bukkit-nms-119R2")
include("structureblocklib-bukkit-core:bukkit-nms-119R3")
include("structureblocklib-bukkit-core:bukkit-nms-120R1")
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ public enum Version {
/**
* Version 1.19.4 - 1.19.4.
*/
VERSION_1_19_R3("v1_19_R3", "1.19.4", 1.194);
VERSION_1_19_R3("v1_19_R3", "1.19.4", 1.194),

/**
* Version 1.20 - 1.20.
*/
VERSION_1_20_R1("v1_20_R1", "1.20.0", 1.20);

private final String bukkitId;
private final String id;
Expand Down
55 changes: 53 additions & 2 deletions structureblocklib-bukkit-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ tasks.withType<ShadowJar> {
relocate("org.jetbrains", "com.github.shynixn.structureblocklib.lib.org.jetbrains")
}

tasks.register("pluginJar", Exec::class.java) {
tasks.register("pluginJarOperation1", Exec::class.java) {
// Change the output folder of the plugin.
// val destinationDir = File("C:/temp/plugins")
val destinationDir = File(buildDir, "libs")

dependsOn("shadowJar")
workingDir = buildDir

Expand All @@ -40,7 +44,7 @@ tasks.register("pluginJar", Exec::class.java) {
val shadowJar = tasks.findByName("shadowJar")!! as ShadowJar
val sourceJarFile = File(buildDir, "libs/" + shadowJar.archiveName)
val archiveName = "${shadowJar.baseName}-${shadowJar.version}.${shadowJar.extension}"
val targetJarFile = File(buildDir, "libs/$archiveName")
val targetJarFile = File(destinationDir, archiveName)

var obsMapping = createCommand(
"1.17.1-R0.1-SNAPSHOT",
Expand Down Expand Up @@ -98,6 +102,52 @@ tasks.register("pluginJar", Exec::class.java) {
}
}

tasks.register("pluginJar", Exec::class.java, ) {
dependsOn("shadowJar","pluginJarOperation1")
// Change the output folder of the plugin.
//val destinationDir = File("C:/temp/plugins")
val destinationDir = File(buildDir, "libs")
workingDir = buildDir

if (!workingDir.exists()) {
workingDir.mkdir();
}

val folder = File(workingDir, "mapping")

if (!folder.exists()) {
folder.mkdir()
}

val file = File(folder, "SpecialSources.jar")

if (!file.exists()) {
URL("https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar").openStream()
.use {
Files.copy(it, file.toPath())
}
}

val shadowJar = tasks.findByName("shadowJar")!! as ShadowJar
val archiveName = "${shadowJar.baseName}-${shadowJar.version}.${shadowJar.extension}"
val targetJarFile = File(destinationDir, archiveName)

var obsMapping = createCommand(
"1.20-R0.1-SNAPSHOT",
"com/github/shynixn/structureblocklib/bukkit/v1_20_R1",
file,
shadowJar,
targetJarFile,
targetJarFile
)

if (System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")) {
commandLine = listOf("cmd", "/c", obsMapping.replace("\$HOME", "%userprofile%"))
} else {
commandLine = listOf("sh", "-c", obsMapping)
}
}

fun createCommand(
version: String,
include: String,
Expand Down Expand Up @@ -131,6 +181,7 @@ dependencies {
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-119R1"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-119R2"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-119R3"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-120R1"))

compileOnly("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
testCompile("org.spigotmc:spigot:1.12-R0.1-SNAPSHOT")
Expand Down
24 changes: 24 additions & 0 deletions structureblocklib-bukkit-core/bukkit-nms-120R1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repositories {
maven(url = "https://libraries.minecraft.net")
}

dependencies {
// Dependencies of spigot mojang want to restrict usage to only Java 17. However, we do not care
// what they want because the general compatibility of this plugin is Java 8. The plugin
// guarantees that everything works during runtime. This error is a false positive.
components {
all {
allVariants {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
}
}
}
}

implementation(project(":structureblocklib-api"))
implementation(project(":structureblocklib-core"))
implementation(project(":structureblocklib-bukkit-api"))
compileOnly("org.spigotmc:spigot:1.20-R0.1-SNAPSHOT:remapped-mojang")
testCompile("org.spigotmc:spigot:1.20-R0.1-SNAPSHOT:remapped-mojang")
}
Loading

0 comments on commit f8a2f5a

Please sign in to comment.