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
Show all changes
42 commits
Select commit Hold shift + click to select a range
276470f
#73 Added 1.17 implementation.
Jun 11, 2021
0c1092a
#73 Changed to mojang mappings for 1.17.
Jun 11, 2021
fcc3605
#73 Changed to jdk 16 build and fixed bugs. --snapshot
Jun 11, 2021
47458cc
#73 Changed name. --snapshot
Jun 11, 2021
86f201e
#73 Added docker stages to resolve dependencies. --snapshot
Jun 11, 2021
43a1fca
#73 Fixed dependencies. --snapshot
Jun 11, 2021
9ba1a33
#73 Init cache.
Jun 11, 2021
09a95aa
#73 Init cache.
Jun 11, 2021
c2499f5
#73 Init cache.
Jun 11, 2021
e349fad
#73 Init cache.
Jun 11, 2021
a1619a0
#73 Init cache.
Jun 11, 2021
88c33be
#73 Init cache.
Jun 11, 2021
737f8f6
#73 Init cache.
Jun 11, 2021
dc929a2
#73 Init cache.
Jun 11, 2021
2613e95
#73 Init cache.
Jun 11, 2021
f9e27cd
#73 Init cache.
Jun 11, 2021
8e739a8
#73 Init cache.
Jun 11, 2021
b3f0dbf
#73 Init cache.
Jun 11, 2021
fe34064
#73 Init cache.
Jun 11, 2021
f6f66d0
#73 Init cache.
Jun 11, 2021
49e1bf6
#73 Init cache.
Jun 11, 2021
b08fc0f
#73 Init cache.
Jun 11, 2021
3dd7996
#73 Init cache.
Jun 11, 2021
fabd8da
#73 Init cache.
Jun 11, 2021
ac6c807
#73 Init cache.
Jun 11, 2021
464b9fb
#73 Init cache.
Jun 11, 2021
d2a5d70
#73 Init cache.
Jun 11, 2021
86181a4
#73 Init cache.
Jun 11, 2021
c28246a
#73 Demo snapshot. --snapshot
Jun 11, 2021
fd3c167
#73 Demo snapshot. --snapshot
Jun 11, 2021
22d9c33
#73 Demo snapshot. --snapshot
Jun 11, 2021
8f4c759
#73 Demo snapshot. --snapshot
Jun 11, 2021
e95b498
#73 Demo snapshot. --snapshot
Jun 11, 2021
d51860d
#73 Demo snapshot. --snapshot
Jun 11, 2021
e54cadb
#73 Upgraded dokka version. --snapshot
Jun 12, 2021
3ac6bcc
#73 Fixed key file. --snapshot
Jun 12, 2021
ecfe9d2
#73 Fixed key file. --snapshot
Jun 12, 2021
343ade3
#73 Fixed publication settings. --snapshot
Jun 12, 2021
f6de1e0
#73 Fixed javadocs. --snapshot
Jun 12, 2021
c9d9cfa
#73 Fixed publication settings. --snapshot
Jun 12, 2021
84b54cd
#73 Fixed docker file.
Jun 12, 2021
4928ad7
#73 Updated config files.
Jun 12, 2021
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.github/*
.gradle/*
.idea/*
build/*
docs/*
Dockerfile
.dockerignore
README.md
39 changes: 34 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,44 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '8'
java-version: '16'

- name: Cache Spigot Dependencies
id: cache-spigot-dependencies
uses: actions/cache@v2
with:
path: /home/runner/.m2/repository/org/spigotmc
key: spigot-dependencies
key: spigot-dependency

- name: Validate Spigot Dependencies
run: |
test -f ~/.m2/repository/org/spigotmc/spigot/1.9.4-R0.1-SNAPSHOT/spigot-1.9.4-R0.1-SNAPSHOT.jar && echo "DEPENDENCIES=true" >> $GITHUB_ENV

- name: Build Spigot Dependencies
if: ${{ env.DEPENDENCIES != 'true' }}
run: |
mkdir -p ~/.m2/repository/org/spigotmc/
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

- name: Build Java Application
run: |
chmod +x gradlew
./gradlew assemble || ./gradlew downloadDependencies
./gradlew clean build shadowJar
./gradlew build pluginJar

- name: Publish Test Report
run: |
./gradlew jacocoTestReport
bash <(curl -s https://codecov.io/bash)

- name: Publish Release to Maven Central
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')"
if: ${{ github.ref == 'refs/heads/main' }}
env:
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
Expand All @@ -57,6 +74,18 @@ jobs:
./gradlew clean publishToNexus
./gradlew closeAndReleaseRepository

- name: Publish Snapshot
if: "contains(github.event.head_commit.message, '--snapshot')"
env:
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_KEY_FILE: ${{ secrets.SIGNING_KEY_FILE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
gpg2 --batch --cipher-algo AES256 --passphrase ${{ secrets.SIGNING_KEY_PASSWORD }} travis_secret_key.gpg
./gradlew publish > /dev/null

- name: Create Github Release
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')"
id: create_release
Expand Down
69 changes: 56 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,59 @@
FROM openjdk:8
# This docker file uses multi-stage builds.
# 1. Resolve minecraft-dependencies for 1.8 - 1.16 with jdk8
FROM openjdk:8 AS dependencies-jdk8
WORKDIR /tmp
RUN apt-get update
RUN apt-get install maven -y
RUN wget "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
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"]

WORKDIR /minecraft
# 2. Resolve minecraft-dependencies for 1.17 - latest with jdk16
FROM adoptopenjdk/openjdk16 AS dependencies-jdk16
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 wget "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
RUN java -jar BuildTools.jar --rev 1.17 --remapped

COPY ["structureblocklib-tools", "structureblocklib-bukkit-sample/build/libs", "./"]
# 3. Build plugin for 1.8 - 1.17 with jdk16
FROM adoptopenjdk/openjdk16 AS plugin-jdk16
WORKDIR /tmp
RUN apt-get update
RUN apt-get install maven -y
RUN apt-get 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 . /tmp
RUN chmod +x gradlew
RUN dos2unix gradlew
RUN ./gradlew build pluginJar --no-daemon

RUN wget "https://hub.spigotmc.org/jenkins/job/BuildTools/lastStableBuild/artifact/target/BuildTools.jar" && \
java -Xmx1024M -jar BuildTools.jar --rev "1.15" && \
echo "eula=true" > eula.txt

CMD rm -r plugins/PetBlocks -f && \
rm -r world -f && \
rm -r world_nether -f && \
rm -r world_the_end -f && \
cp -r world-1.14/world . && \
java -Xmx1024M -Xmx1024M -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar spigot-1.15.jar
# 4. Launch a minecraft server with jdk16 and plugin
FROM adoptopenjdk/openjdk16
# Change to the current plugin version present in build.gradle
ENV PLUGIN_VERSION=2.2.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
# Port of the Minecraft Server.
EXPOSE 25565
# Port for Remote Debugging
EXPOSE 5005
WORKDIR /app
RUN apt-get update
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
CMD ["sh","-c","java -DIReallyKnowWhatIAmDoingISwear -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar spigot.jar"]
81 changes: 52 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

| branch | status | version | download |
| ------------- | ------------- | -------- | --------|
| master | [![Build Status](https://img.shields.io/travis/Shynixn/StructureBlockLib/master.svg?style=flat-square)](https://travis-ci.org/Shynixn/StructureBlockLib) |![GitHub license](https://img.shields.io/nexus/r/https/oss.sonatype.org/com.github.shynixn.structureblocklib/structureblocklib-bukkit-plugin.svg?style=flat-square) |[Download latest release](https://github.com/Shynixn/StructureBlockLib/releases)|
| development | [![Build Status](https://img.shields.io/travis/Shynixn/StructureBlockLib/development.svg?style=flat-square)](https://travis-ci.org/Shynixn/StructureBlockLib)|![GitHub license](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.shynixn.structureblocklib/structureblocklib-bukkit-plugin.svg?style=flat-square) | [Download snapshots](https://oss.sonatype.org/content/repositories/snapshots/com/github/shynixn/structureblocklib/structureblocklib-bukkit-plugin/) |
| master | [![Build Status](https://github.com/Shynixn/StructureBlockLib/workflows/CI/badge.svg?branch=master)](https://github.com/Shynixn/StructureBlockLib/actions) |![GitHub license](https://img.shields.io/nexus/r/https/oss.sonatype.org/com.github.shynixn.structureblocklib/structureblocklib-bukkit-plugin.svg?style=flat-square) |[Download latest release](https://github.com/Shynixn/StructureBlockLib/releases)|
| development | [![Build Status](https://github.com/Shynixn/StructureBlockLib/workflows/CI/badge.svg?branch=development)](https://github.com/Shynixn/StructureBlockLib/actions)|![GitHub license](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.shynixn.structureblocklib/structureblocklib-bukkit-plugin.svg?style=flat-square) | [Download snapshots](https://oss.sonatype.org/content/repositories/snapshots/com/github/shynixn/structureblocklib/structureblocklib-bukkit-plugin/) |

JavaDocs: https://shynixn.github.io/StructureBlockLib/apidocs/

Expand All @@ -13,11 +13,12 @@ StructureBlockLib is a bukkit API and implementation for handling structures on

## Features

* Full blown Bukkit Api for the StructureBlock.
* Bukkit API for the StructureBlock.
* API to save or load structures without an actual structure block.
* Asynchronous implementation and API.
* Fluent API.
* Version support 1.9.R1 - 1.16.R3
* Version support 1.9.R1 - 1.17.R1
* Java support 8 - Latest

## Installation

Expand All @@ -28,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.1.0</version>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
```
**Gradle**

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

Expand Down Expand Up @@ -182,47 +183,69 @@ 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.1.0</version>
<version>2.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.shynixn.structureblocklib</groupId>
<artifactId>structureblocklib-bukkit-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
<scope>compile</scope>
</dependency>
```
**Gradle**

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

## Contributing

* Fork the StructureBlockLib project on github and clone it to your local environment.
* Install Java 8 (later versions are not supported by the ``downloadDependencies`` task)
* Install Apache Maven
* Make sure ``java`` points to a Java 8 installation (``java -version``)
* Make sure ``$JAVA_HOME`` points to a Java 8 installation
* Make sure ``mvn`` points to a Maven installation (``mvn --version``)
* Execute gradle sync for dependencies
* Install the additional spigot dependencies by executing the following gradle task (this task can take a very long time)

```xml
[./gradlew|gradlew.bat] downloadDependencies
```

(If the downloadDependencies task fails for some reason, you can manually download [BuildTools.jar](https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar) and execute [the commands on this page](https://github.com/Shynixn/StructureBlockLib/blob/8a9bf2a402ba30118205ec400b7d1ab6562ecbf8/build.gradle#L224).)
### Setting up development environment

* Build the module files by executing the following gradle task.

```xml
[./gradlew|gradlew.bat] shadowJar
```
* Install Java 16 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.
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.

Note: If using Windows, execute the commands using Git Bash.
````sh
mkdir -p ~/.m2/repository/org/spigotmc/
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
````

* Open the project with an IDE, gradle sync for dependencies.

### Testing

#### Option 1

* Setup your own minecraft server
* Change ``// val destinationDir = File("C:/temp/plugins")`` to your plugins folder in the ``structureblocklib-bukkit-sample/build.gradle.kts`` file.
* Run the ``pluginJar`` task to generate a plugin.jar file.
* Run your minecraft server

#### Option 2 :whale:

* Run the provided docker file.
* The source code is copied to a new docker container and built to a plugin.
* This plugin is installed on a new minecraft server which is accessible on the host machine on the default port on ``localhost``.

````sh
docker build -t structureblocklib .
docker run --name=structureblocklib -p 25565:25565 -p 5005:5005 structureblocklib
````

## Licence

Expand Down
Loading