Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '16'
java-version: '17'

- name: Cache Spigot Dependencies
id: cache-spigot-dependencies
Expand All @@ -45,10 +45,10 @@ jobs:
docker create --name structureblocklib-dependencies-jdk8 structureblocklib-dependencies-jdk8 bash
docker cp structureblocklib-dependencies-jdk8:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk8
docker build --target dependencies-jdk16 -t structureblocklib-dependencies-jdk16 .
docker create --name structureblocklib-dependencies-jdk16 structureblocklib-dependencies-jdk16 bash
docker cp structureblocklib-dependencies-jdk16:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk16
docker build --target dependencies-jdk17 -t structureblocklib-dependencies-jdk17 .
docker create --name structureblocklib-dependencies-jdk17 structureblocklib-dependencies-jdk17 bash
docker cp structureblocklib-dependencies-jdk17:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk17

- name: Build Java Application
run: |
Expand Down
43 changes: 22 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,52 @@ RUN java -jar BuildTools.jar --rev 1.9.4
RUN java -jar BuildTools.jar --rev 1.10
RUN java -jar BuildTools.jar --rev 1.11
RUN java -jar BuildTools.jar --rev 1.12
RUN java -jar BuildTools.jar --rev 1.16.4
RUN java -jar BuildTools.jar --rev 1.13.2
RUN java -jar BuildTools.jar --rev 1.14.4
RUN java -jar BuildTools.jar --rev 1.15
RUN java -jar BuildTools.jar --rev 1.16.4
CMD ["sh","-c","/bin/bash"]

# 2. Resolve minecraft-dependencies for 1.17 - latest with jdk16
FROM adoptopenjdk/openjdk16 AS dependencies-jdk16
# 2. Resolve minecraft-dependencies for 1.17 - 1.18 - latest with jdk17
FROM amazoncorretto:17 AS dependencies-jdk17
WORKDIR /tmp
RUN apt-get update
RUN apt-get install maven -y
RUN apt-get install wget -y
RUN apt-get install git -y
RUN yum update -y
RUN yum install maven -y
RUN yum install wget -y
RUN yum install git -y
RUN wget "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
RUN java -jar BuildTools.jar --rev 1.17 --remapped
RUN java -jar BuildTools.jar --rev 1.17.1 --remapped
RUN java -jar BuildTools.jar --rev 1.18 --remapped

# 3. Build plugin for 1.8 - 1.17 with jdk16
FROM adoptopenjdk/openjdk16 AS plugin-jdk16
# 3. Build plugin for 1.8 - 1.17 with jdk17
FROM amazoncorretto:17 AS plugin-jdk17
WORKDIR /tmp
RUN apt-get update
RUN apt-get install maven -y
RUN apt-get install dos2unix -y
RUN yum update -y
RUN yum install maven -y
RUN yum install dos2unix -y
COPY --from=dependencies-jdk8 /root/.m2/repository/org/spigotmc /root/.m2/repository/org/spigotmc/
COPY --from=dependencies-jdk16 /root/.m2/repository/org/spigotmc /root/.m2/repository/org/spigotmc/
COPY --from=dependencies-jdk17 /root/.m2/repository/org/spigotmc /root/.m2/repository/org/spigotmc/
COPY . /tmp
RUN chmod +x gradlew
RUN dos2unix gradlew
RUN ./gradlew build pluginJar --no-daemon

# 4. Launch a minecraft server with jdk16 and plugin
FROM adoptopenjdk/openjdk16
# 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.2.2
ENV PLUGIN_VERSION=2.3.0
# Change to the server version you want to test.
ENV SERVER_VERSION=1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT.jar
ENV SERVER_VERSION=spigot-1.18.jar
# Port of the Minecraft Server.
EXPOSE 25565
# Port for Remote Debugging
EXPOSE 5005
WORKDIR /app
RUN apt-get update
RUN yum update -y
RUN echo "eula=true" > eula.txt && mkdir plugins
COPY ./structureblocklib-tools/world-1.14 /app/
COPY ./structureblocklib-tools/ops.json /app/
COPY --from=dependencies-jdk16 /root/.m2/repository/org/spigotmc/spigot/$SERVER_VERSION /app/spigot.jar
COPY --from=plugin-jdk16 /tmp/structureblocklib-bukkit-sample/build/libs/structureblocklib-bukkit-sample-$PLUGIN_VERSION.jar /app/plugins/Structureblocklib.jar
# For < 1.18 COPY --from=dependencies-jdk17 /root/.m2/repository/org/spigotmc/spigot/$SERVER_VERSION /app/spigot.jar
COPY --from=dependencies-jdk17 /tmp/$SERVER_VERSION /app/spigot.jar
COPY --from=plugin-jdk17 /tmp/structureblocklib-bukkit-sample/build/libs/structureblocklib-bukkit-sample-$PLUGIN_VERSION.jar /app/plugins/Structureblocklib.jar
CMD ["sh","-c","java -DIReallyKnowWhatIAmDoingISwear -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar spigot.jar"]
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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.17.R1
* Version support 1.9.R1 - 1.18.R1
* Java support 8 - Latest

## Installation
Expand All @@ -29,15 +29,15 @@ StructureBlockLib is a bukkit API and implementation for handling structures on
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-api</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
```
**Gradle**

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

Expand Down Expand Up @@ -174,8 +174,8 @@ structureBlock.update();
**plugin.yml**
```yaml
libraries:
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.2.2
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.2.2
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-api:2.3.0
- com.github.shynixn.structureblocklib:structureblocklib-bukkit-core:2.3.0
```

### For version < 1.17
Expand All @@ -194,32 +194,32 @@ 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.2.2</version>
<version>2.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
<scope>compile</scope>
</dependency>
```
**Gradle**

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

## Contributing

### Setting up development environment

* Install Java 16 or higher
* 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.17 to be correctly installed in your local Maven cache.
* StructureBlockLib requires spigot server implementations from 1.9.4 to 1.18 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 All @@ -230,10 +230,10 @@ docker build --target dependencies-jdk8 -t structureblocklib-dependencies-jdk8 .
docker create --name structureblocklib-dependencies-jdk8 structureblocklib-dependencies-jdk8 bash
docker cp structureblocklib-dependencies-jdk8:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk8
docker build --target dependencies-jdk16 -t structureblocklib-dependencies-jdk16 .
docker create --name structureblocklib-dependencies-jdk16 structureblocklib-dependencies-jdk16 bash
docker cp structureblocklib-dependencies-jdk16:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk16
docker build --target dependencies-jdk17 -t structureblocklib-dependencies-jdk17 .
docker create --name structureblocklib-dependencies-jdk17 structureblocklib-dependencies-jdk17 bash
docker cp structureblocklib-dependencies-jdk17:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/
docker rm -f structureblocklib-dependencies-jdk17
````

* Open the project with an IDE, gradle sync for dependencies.
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: '1.3.72'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.32"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.31"
}
}

Expand Down Expand Up @@ -44,7 +44,7 @@ tasks.register("printVersion") {

subprojects {
group 'com.github.shynixn.structureblocklib'
version '2.2.2'
version '2.3.0'

apply plugin: 'kotlin-platform-jvm'
apply plugin: 'signing'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ include("structureblocklib-bukkit-core:bukkit-nms-114R1")
include("structureblocklib-bukkit-core:bukkit-nms-115R1")
include("structureblocklib-bukkit-core:bukkit-nms-116R3")
include("structureblocklib-bukkit-core:bukkit-nms-117R1")
include("structureblocklib-bukkit-core:bukkit-nms-118R1")
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ public enum Version {
VERSION_1_16_R3("v1_16_R3", "1.16.4", 1.164),

/**
* Version 1.17.0 - 1.17.0.
* Version 1.17.0 - 1.17.1.
*/
VERSION_1_17_R1("v1_17_R1", "1.17.0", 1.170);
VERSION_1_17_R1("v1_17_R1", "1.17.0", 1.170),

/**
* Version 1.18.0 - 1.17.0.
*/
VERSION_1_18_R1("v1_18_R1", "1.18.0", 1.180);

private final String bukkitId;
private final String id;
Expand Down
39 changes: 33 additions & 6 deletions structureblocklib-bukkit-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,26 @@ tasks.register("pluginJar", Exec::class.java) {
}

val shadowJar = tasks.findByName("shadowJar")!! as ShadowJar
val obfArchiveName = "${shadowJar.baseName}-${shadowJar.version}-obfuscated.${shadowJar.extension}"
val archiveName = "${shadowJar.baseName}-${shadowJar.version}.${shadowJar.extension}"
val sourceJarFile = File(buildDir, "libs/" + shadowJar.archiveName)
val obfJarFile = File(buildDir, "libs/$obfArchiveName")
val archiveName = "${shadowJar.baseName}-${shadowJar.version}.${shadowJar.extension}"
val targetJarFile = File(buildDir, "libs/$archiveName")

val obsMapping =
"java -jar ${file.absolutePath} -i \"$sourceJarFile\" -o \"$obfJarFile\" -m \"\$HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-mojang.txt\" --reverse" +
"&& java -jar ${file.absolutePath} -i \"$obfJarFile\" -o \"$targetJarFile\" -m \"\$HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-spigot.csrg\""
var obsMapping = createCommand(
"1.17.1-R0.1-SNAPSHOT",
"com/github/shynixn/structureblocklib/bukkit/v1_17_R1",
file,
shadowJar,
sourceJarFile,
targetJarFile
)
obsMapping = "$obsMapping && " + createCommand(
"1.18-R0.1-SNAPSHOT",
"com/github/shynixn/structureblocklib/bukkit/v1_18_R1",
file,
shadowJar,
targetJarFile,
targetJarFile
)

if (System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")) {
commandLine = listOf("cmd", "/c", obsMapping.replace("\$HOME", "%userprofile%"))
Expand All @@ -55,6 +66,21 @@ tasks.register("pluginJar", Exec::class.java) {
}
}

fun createCommand(
version: String,
include: String,
file: File,
shadowJar: ShadowJar,
sourceJarFile: File,
targetJarFile: File
): String {
val obfArchiveName = "${shadowJar.baseName}-${shadowJar.version}-obfuscated.${shadowJar.extension}"
val obfJarFile = File(buildDir, "libs/$obfArchiveName")

return "java -jar ${file.absolutePath} -i \"$sourceJarFile\" -o \"$obfJarFile\" -only \"$include\" -m \"\$HOME/.m2/repository/org/spigotmc/minecraft-server/${version}/minecraft-server-${version}-maps-mojang.txt\" --reverse" +
"&& java -jar ${file.absolutePath} -i \"$obfJarFile\" -o \"$targetJarFile\" -only \"$include\" -m \"\$HOME/.m2/repository/org/spigotmc/minecraft-server/${version}/minecraft-server-${version}-maps-spigot.csrg\""
}

dependencies {
implementation(project(":structureblocklib-api"))
implementation(project(":structureblocklib-core"))
Expand All @@ -68,6 +94,7 @@ dependencies {
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-115R1"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-116R3"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-117R1"))
implementation(project(":structureblocklib-bukkit-core:bukkit-nms-118R1"))

compileOnly("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
testCompile("org.spigotmc:spigot:1.12-R0.1-SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ dependencies {
implementation(project(":structureblocklib-api"))
implementation(project(":structureblocklib-core"))
implementation(project(":structureblocklib-bukkit-api"))
compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:remapped-mojang")
testCompile("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:remapped-mojang")
compileOnly("org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang")
testCompile("org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang")
}
24 changes: 24 additions & 0 deletions structureblocklib-bukkit-core/bukkit-nms-118R1/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 16. 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.18-R0.1-SNAPSHOT:remapped-mojang")
testCompile("org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:remapped-mojang")
}
Loading