diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml
index c3592fa..4995626 100644
--- a/.github/workflows/maven-publish.yml
+++ b/.github/workflows/maven-publish.yml
@@ -1,7 +1,4 @@
-# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
-# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
-
-name: Maven Package
+name: Maven Publish
on:
release:
@@ -9,7 +6,7 @@ on:
workflow_dispatch:
jobs:
- goats_1_17_1:
+ goats_1_17_1:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 16 # 1.17.1 can be built with Java 16 to Java 17
@@ -21,12 +18,12 @@ jobs:
id: cacheGoats
uses: actions/cache@v2
with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.17.1-all
- restore-keys: ${{ runner.os }}-spigot-1.17.1-all
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.17.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.17.1-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
@@ -49,7 +46,7 @@ jobs:
- name: Build 1.17.1
if: steps.goats.outputs.sucess != 'true' || steps.goatsMojang.outputs.sucess != 'true' || steps.goatsObf.outputs.sucess != 'true'
run: cd BuildTools && java -jar BuildTools.jar --rev 1.17.1 --remapped
- caves_1_18_1:
+ caves_1_18_1:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
@@ -61,12 +58,12 @@ jobs:
id: cacheCaves
uses: actions/cache@v2
with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.18.1-all
- restore-keys: ${{ runner.os }}-spigot-1.18.1-all
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.18.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.18.1-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
@@ -89,7 +86,7 @@ jobs:
- name: Build 1.18.1
if: steps.caves.outputs.sucess != 'true' || steps.cavesMojang.outputs.sucess != 'true' || steps.cavesObf.outputs.sucess != 'true'
run: cd BuildTools && java -jar BuildTools.jar --rev 1.18.1 --remapped
- cliffs_1_18_2:
+ cliffs_1_18_2:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
@@ -101,12 +98,12 @@ jobs:
id: cacheCaves
uses: actions/cache@v2
with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.18.2-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.18.2-all
- restore-keys: ${{ runner.os }}-spigot-1.18.2-all
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.18.2-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.18.2-all
+ restore-keys: ${{ runner.os }}-spigot-1.18.2-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
@@ -129,7 +126,7 @@ jobs:
- name: Build 1.18.2
if: steps.caves.outputs.sucess != 'true' || steps.cavesMojang.outputs.sucess != 'true' || steps.cavesObf.outputs.sucess != 'true'
run: cd BuildTools && java -jar BuildTools.jar --rev 1.18.2 --remapped
- wild_1_19:
+ wild_1_19:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
@@ -141,12 +138,12 @@ jobs:
id: cacheWild
uses: actions/cache@v2
with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.19-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.19-all
- restore-keys: ${{ runner.os }}-spigot-1.19-all
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.19-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.19-all
+ restore-keys: ${{ runner.os }}-spigot-1.19-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
@@ -169,7 +166,7 @@ jobs:
- name: Build 1.19
if: steps.wild.outputs.sucess != 'true' || steps.wildMojang.outputs.sucess != 'true' || steps.wildObf.outputs.sucess != 'true'
run: cd BuildTools && java -jar BuildTools.jar --rev 1.19 --remapped
- chat_1_19_3:
+ chat_1_19_3:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
@@ -181,12 +178,12 @@ jobs:
id: cacheChat
uses: actions/cache@v2
with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.19.3-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.19.3-all
- restore-keys: ${{ runner.os }}-spigot-1.19.3-all
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.19.3-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.19.3-all
+ restore-keys: ${{ runner.os }}-spigot-1.19.3-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
@@ -209,193 +206,293 @@ jobs:
- name: Build 1.19
if: steps.chat.outputs.sucess != 'true' || steps.chatMojang.outputs.sucess != 'true' || steps.chatObf.outputs.sucess != 'true'
run: cd BuildTools && java -jar BuildTools.jar --rev 1.19.3 --remapped
- creative_1_19_4:
- runs-on: ubuntu-latest
- steps:
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- distribution: 'temurin'
- java-version: '17'
- - name: Cache 1.19.3 Maven package
- id: cacheChat
- uses: actions/cache@v2
- with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.19.4-all
- restore-keys: ${{ runner.os }}-spigot-1.19.4-all
- - name: Cache Maven packages
- id: cacheMain
- uses: actions/cache@v2
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2_1.19.4
- restore-keys: ${{ runner.os }}-m2_1.19.4
+ creative_1_19_4:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.19.4 Maven package
+ id: cacheChat
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.19.4-all
+ restore-keys: ${{ runner.os }}-spigot-1.19.4-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.19.4
+ restore-keys: ${{ runner.os }}-m2_1.19.4
+
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.19.4 Spigot
+ id: creative
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.19.4 Spigot (Mojang)
+ id: creativeMojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.19.4 Spigot (Obf)
+ id: creativeObf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.19
+ if: steps.creative.outputs.sucess != 'true' || steps.creativeMojang.outputs.sucess != 'true' || steps.creativeObf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.19.4 --remapped
+ trails_1_20:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.20.1 Maven package
+ id: cacheTrails
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.1-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.20.1
+ restore-keys: ${{ runner.os }}-m2_1.20.1
+
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.20.1 Spigot
+ id: trails
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.1 Spigot (Mojang)
+ id: trailsMojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.1 Spigot (Obf)
+ id: trailsObf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20
+ if: steps.trails.outputs.sucess != 'true' || steps.trailsMojang.outputs.sucess != 'true' || steps.trailsObf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.1 --remapped
+ trails_1_20_2:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.20.2 Maven package
+ id: cacheTrails2
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.2-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.2-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.20.2
+ restore-keys: ${{ runner.os }}-m2_1.20.2
- - name: Setup BuildTools
- run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- - name: Check 1.19.4 Spigot
- id: creative
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.19.4 Spigot (Mojang)
- id: creativeMojang
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.19.4 Spigot (Obf)
- id: creativeObf
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Build 1.19
- if: steps.chat.outputs.sucess != 'true' || steps.chatMojang.outputs.sucess != 'true' || steps.chatObf.outputs.sucess != 'true'
- run: cd BuildTools && java -jar BuildTools.jar --rev 1.19.4 --remapped
- trails_1_20:
- runs-on: ubuntu-latest
- steps:
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- distribution: 'temurin'
- java-version: '17'
- - name: Cache 1.20 Maven package
- id: cacheChat
- uses: actions/cache@v2
- with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.20.-all
- restore-keys: ${{ runner.os }}-spigot-1.20-all
- - name: Cache Maven packages
- id: cacheMain
- uses: actions/cache@v2
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2_1.20
- restore-keys: ${{ runner.os }}-m2_1.20
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.20.2 Spigot
+ id: trails2
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.2 Spigot (Mojang)
+ id: trails2Mojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.2 Spigot (Obf)
+ id: trails2Obf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20.2
+ if: steps.trails2.outputs.sucess != 'true' || steps.trails2Mojang.outputs.sucess != 'true' || steps.trails2Obf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.2 --remapped
+ trails_1_20_3:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.20.3 Maven package
+ id: cacheTrails3
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.3-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.3-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.20.3
+ restore-keys: ${{ runner.os }}-m2_1.20.3
- - name: Setup BuildTools
- run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- - name: Check 1.20 Spigot
- id: trails
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.20 Spigot (Mojang)
- id: trailsMojang
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.20 Spigot (Obf)
- id: trailsObf
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Build 1.20
- if: steps.chat.outputs.sucess != 'true' || steps.chatMojang.outputs.sucess != 'true' || steps.chatObf.outputs.sucess != 'true'
- run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.1 --remapped
- build:
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.20.3 Spigot
+ id: trails3
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.3 Spigot (Mojang)
+ id: trails3Mojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.3 Spigot (Obf)
+ id: trails3Obf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20.3
+ if: steps.trails3.outputs.sucess != 'true' || steps.trails3Mojang.outputs.sucess != 'true' || steps.trails3Obf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.3 --remapped
+ build:
runs-on: ubuntu-latest
- needs: [goats_1_17_1,caves_1_18_1,cliffs_1_18_2,wild_1_19,chat_1_19_3,creative_1_19_4,trails_1_20]
+ needs: [goats_1_17_1,caves_1_18_1,cliffs_1_18_2,wild_1_19,chat_1_19_3,creative_1_19_4, trails_1_20,trails_1_20_2,trails_1_20_3]
permissions:
contents: read
packages: write
steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- java-version: '17'
- distribution: 'temurin'
- server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
- settings-path: ${{ github.workspace }} # location for the settings.xml file
- - name: Cache Maven packages
- id: cacheMain
- uses: actions/cache@v2
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2
- restore-keys: ${{ runner.os }}-m2
- - name: Cache 1.17.1 Maven package
- id: cacheGoats
- uses: actions/cache@v2
- with:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
+ settings-path: ${{ github.workspace }} # location for the settings.xml file
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2
+ restore-keys: ${{ runner.os }}-m2
+ - name: Cache 1.17.1 Maven package
+ id: cacheGoats
+ uses: actions/cache@v2
+ with:
path: |
~/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.17.1-all
restore-keys: ${{ runner.os }}-spigot-1.17.1-all
- - name: Cache 1.18.1 Maven package
- id: cacheCaves
- uses: actions/cache@v2
- with:
+ - name: Cache 1.18.1 Maven package
+ id: cacheCaves
+ uses: actions/cache@v2
+ with:
path: |
~/.m2/repository/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.18.1-all
restore-keys: ${{ runner.os }}-spigot-1.18.1-all
- - name: Cache 1.18.2 Maven package
- id: cacheCliffs
- uses: actions/cache@v2
- with:
+ - name: Cache 1.18.2 Maven package
+ id: cacheCliffs
+ uses: actions/cache@v2
+ with:
path: |
~/.m2/repository/org/spigotmc/spigot/1.18.2-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.18.2-all
restore-keys: ${{ runner.os }}-spigot-1.18.2-all
- - name: Cache 1.19 Maven package
- id: cacheWild
- uses: actions/cache@v2
- with:
+ - name: Cache 1.19 Maven package
+ id: cacheWild
+ uses: actions/cache@v2
+ with:
path: |
~/.m2/repository/org/spigotmc/spigot/1.19-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.19-all
restore-keys: ${{ runner.os }}-spigot-1.19-all
- - name: Cache 1.19.3 Maven package
- id: cacheChat
- uses: actions/cache@v2
- with:
+ - name: Cache 1.19.3 Maven package
+ id: cacheChat
+ uses: actions/cache@v2
+ with:
path: |
~/.m2/repository/org/spigotmc/spigot/1.19.3-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.19.3-all
restore-keys: ${{ runner.os }}-spigot-1.19.3-all
- - name: Cache 1.19.4 Maven package
- id: cacheCreative
- uses: actions/cache@v2
- with:
+ - name: Cache 1.19.4 Maven package
+ id: cacheCreative
+ uses: actions/cache@v2
+ with:
path: |
- ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
+ ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.19.4-all
restore-keys: ${{ runner.os }}-spigot-1.19.4-all
- - name: Cache 1.20 Maven package
- id: cacheTrails
- uses: actions/cache@v2
- with:
+ - name: Cache 1.20.1 Maven package
+ id: cacheTrails
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.1-all
+ - name: Cache 1.20.2 Maven package
+ id: cacheTrails2
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.2-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.2-all
+ - name: Cache 1.20.3 Maven package
+ id: cacheTrails3
+ uses: actions/cache@v2
+ with:
path: |
- ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.20-all
- restore-keys: ${{ runner.os }}-spigot-1.20-all
- - uses: s4u/maven-settings-action@v2.3.0
- with:
+ ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.3-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.3-all
+ - uses: s4u/maven-settings-action@v2.3.0
+ with:
servers: |
[{
"id": "tippie-repo",
"username": "${{ secrets.TIPPIE_REPO_USERNAME }}",
"password": "${{ secrets.TIPPIE_REPO_PASSWORD }}"
}]
- - name: Build with Maven
- run: mvn -B package --file pom.xml
- - name: Deploy to tippie-repo
- run: mvn deploy
- - name: Upload Artifacts
- uses: actions/upload-artifact@v3
- with:
- name: artifact
- path: target/
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+ - name: Deploy to tippie-repo
+ run: mvn -B deploy --file pom.xml
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: artifact
+ path: target/
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e424a53..5b9b4dd 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
-name: Java CI with Maven
+name: Maven Build
on:
push:
@@ -213,43 +213,43 @@ jobs:
creative_1_19_4:
runs-on: ubuntu-latest
steps:
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- distribution: 'temurin'
- java-version: '17'
- - name: Cache 1.19.4 Maven package
- id: cacheChat
- uses: actions/cache@v2
- with:
- path: |
- ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
- ~/.m2/repository/org/spigotmc/spigot-parent/
- ~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.19.4-all
- restore-keys: ${{ runner.os }}-spigot-1.19.4-all
- - name: Cache Maven packages
- id: cacheMain
- uses: actions/cache@v2
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2_1.19.4
- restore-keys: ${{ runner.os }}-m2_1.19.4
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.19.4 Maven package
+ id: cacheChat
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.19.4-all
+ restore-keys: ${{ runner.os }}-spigot-1.19.4-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.19.4
+ restore-keys: ${{ runner.os }}-m2_1.19.4
- - name: Setup BuildTools
- run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- - name: Check 1.19.4 Spigot
- id: creative
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.19.4 Spigot (Mojang)
- id: creativeMojang
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.19.4 Spigot (Obf)
- id: creativeObf
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Build 1.19
- if: steps.chat.outputs.sucess != 'true' || steps.chatMojang.outputs.sucess != 'true' || steps.chatObf.outputs.sucess != 'true'
- run: cd BuildTools && java -jar BuildTools.jar --rev 1.19.4 --remapped
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.19.4 Spigot
+ id: creative
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.19.4 Spigot (Mojang)
+ id: creativeMojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.19.4 Spigot (Obf)
+ id: creativeObf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.19
+ if: steps.creative.outputs.sucess != 'true' || steps.creativeMojang.outputs.sucess != 'true' || steps.creativeObf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.19.4 --remapped
trails_1_20:
runs-on: ubuntu-latest
steps:
@@ -258,41 +258,121 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- - name: Cache 1.20 Maven package
- id: cacheChat
+ - name: Cache 1.20.1 Maven package
+ id: cacheTrails
uses: actions/cache@v2
with:
path: |
- ~/.m2/repository/org/spigotmc/spigot/1.20-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.20-all
- restore-keys: ${{ runner.os }}-spigot-1.20-all
+ key: ${{ runner.os }}-spigot-1.20.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.1-all
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v2
with:
path: ~/.m2
- key: ${{ runner.os }}-m2_1.20
- restore-keys: ${{ runner.os }}-m2_1.20
+ key: ${{ runner.os }}-m2_1.20.1
+ restore-keys: ${{ runner.os }}-m2_1.20.1
- name: Setup BuildTools
run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- - name: Check 1.20 Spigot
+ - name: Check 1.20.1 Spigot
id: trails
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20-R0.1-SNAPSHOT/spigot-1.20-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.20 Spigot (Mojang)
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.1 Spigot (Mojang)
id: trailsMojang
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20-R0.1-SNAPSHOT/spigot-1.20-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Check 1.20 Spigot (Obf)
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.1 Spigot (Obf)
id: trailsObf
- run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20-R0.1-SNAPSHOT/spigot-1.20-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
- - name: Build 1.20
- if: steps.chat.outputs.sucess != 'true' || steps.chatMojang.outputs.sucess != 'true' || steps.chatObf.outputs.sucess != 'true'
- run: cd BuildTools && java -jar BuildTools.jar --rev 1.20 --remapped
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20.1
+ if: steps.trails.outputs.sucess != 'true' || steps.trailsMojang.outputs.sucess != 'true' || steps.trailsObf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.1 --remapped
+ trails_1_20_2:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.20.2 Maven package
+ id: cacheTrails2
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.2-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.2-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.20.2
+ restore-keys: ${{ runner.os }}-m2_1.20.2
+
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.20.2 Spigot
+ id: trails2
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.2 Spigot (Mojang)
+ id: trails2Mojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.2 Spigot (Obf)
+ id: trails2Obf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20.2
+ if: steps.trails2.outputs.sucess != 'true' || steps.trails2Mojang.outputs.sucess != 'true' || steps.trails2Obf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.2 --remapped
+ trails_1_20_3:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Cache 1.20.3 Maven package
+ id: cacheTrails3
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.3-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.3-all
+ - name: Cache Maven packages
+ id: cacheMain
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2_1.20.3
+ restore-keys: ${{ runner.os }}-m2_1.20.3
+
+ - name: Setup BuildTools
+ run: mkdir BuildTools && wget -O BuildTools/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ - name: Check 1.20.3 Spigot
+ id: trails3
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.3 Spigot (Mojang)
+ id: trails3Mojang
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT-remapped-mojang.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Check 1.20.3 Spigot (Obf)
+ id: trails3Obf
+ run: test -f ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/spigot-1.20.3-R0.1-SNAPSHOT-remapped-obf.jar && echo "::set-output name=sucess::true" || echo "::set-output name=sucess::false"
+ - name: Build 1.20.3
+ if: steps.trails3.outputs.sucess != 'true' || steps.trails3Mojang.outputs.sucess != 'true' || steps.trails3Obf.outputs.sucess != 'true'
+ run: cd BuildTools && java -jar BuildTools.jar --rev 1.20.3 --remapped
build:
runs-on: ubuntu-latest
- needs: [goats_1_17_1,caves_1_18_1,cliffs_1_18_2,wild_1_19,chat_1_19_3,creative_1_19_4, trails_1_20]
+ needs: [goats_1_17_1,caves_1_18_1,cliffs_1_18_2,wild_1_19,chat_1_19_3,creative_1_19_4, trails_1_20,trails_1_20_2,trails_1_20_3]
permissions:
contents: read
packages: write
@@ -373,24 +453,44 @@ jobs:
~/.m2/repository/org/spigotmc/minecraft-server/
key: ${{ runner.os }}-spigot-1.19.4-all
restore-keys: ${{ runner.os }}-spigot-1.19.4-all
- - name: Cache 1.20 Maven package
+ - name: Cache 1.20.1 Maven package
id: cacheTrails
uses: actions/cache@v2
with:
path: |
- ~/.m2/repository/org/spigotmc/spigot/1.20-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/
~/.m2/repository/org/spigotmc/spigot-parent/
~/.m2/repository/org/spigotmc/minecraft-server/
- key: ${{ runner.os }}-spigot-1.20-all
- restore-keys: ${{ runner.os }}-spigot-1.20-all
+ key: ${{ runner.os }}-spigot-1.20.1-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.1-all
+ - name: Cache 1.20.2 Maven package
+ id: cacheTrails2
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.2-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.2-all
+ - name: Cache 1.20.3 Maven package
+ id: cacheTrails3
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.m2/repository/org/spigotmc/spigot/1.20.3-R0.1-SNAPSHOT/
+ ~/.m2/repository/org/spigotmc/spigot-parent/
+ ~/.m2/repository/org/spigotmc/minecraft-server/
+ key: ${{ runner.os }}-spigot-1.20.3-all
+ restore-keys: ${{ runner.os }}-spigot-1.20.3-all
- uses: s4u/maven-settings-action@v2.3.0
with:
- servers: |
- [{
- "id": "tippie-repo",
- "username": "${{ secrets.TIPPIE_REPO_USERNAME }}",
- "password": "${{ secrets.TIPPIE_REPO_PASSWORD }}"
- }]
+ servers: |
+ [{
+ "id": "tippie-repo",
+ "username": "${{ secrets.TIPPIE_REPO_USERNAME }}",
+ "password": "${{ secrets.TIPPIE_REPO_PASSWORD }}"
+ }]
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload Artifacts
diff --git a/core/pom.xml b/core/pom.xml
index 9af9491..6a3431b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/dist/pom.xml b/dist/pom.xml
index ee91265..c40ba3a 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -10,7 +10,7 @@
customadvancements-parent
me.tippie
- 1.2.9
+ 1.2.10
@@ -81,6 +81,16 @@
customadvancements-spigot_1_20_R1
${project.parent.version}
+
+ me.tippie
+ customadvancements-spigot_1_20_R2
+ ${project.parent.version}
+
+
+ me.tippie
+ customadvancements-spigot_1_20_R3
+ ${project.parent.version}
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index d64a621..2cf709d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
pom
CustomAdvancements
@@ -33,6 +33,8 @@
spigot_1_19_R2
spigot_1_19_R3
spigot_1_20_R1
+ spigot_1_20_R2
+ spigot_1_20_R3
dist
\ No newline at end of file
diff --git a/spigot_1_17_R1/pom.xml b/spigot_1_17_R1/pom.xml
index 1f20d3d..dbe5f31 100644
--- a/spigot_1_17_R1/pom.xml
+++ b/spigot_1_17_R1/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_18_R1/pom.xml b/spigot_1_18_R1/pom.xml
index 697d9f6..f4116a7 100644
--- a/spigot_1_18_R1/pom.xml
+++ b/spigot_1_18_R1/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_18_R2/pom.xml b/spigot_1_18_R2/pom.xml
index b744aaa..6274262 100644
--- a/spigot_1_18_R2/pom.xml
+++ b/spigot_1_18_R2/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_19_R1/pom.xml b/spigot_1_19_R1/pom.xml
index 35a9c34..0dab43a 100644
--- a/spigot_1_19_R1/pom.xml
+++ b/spigot_1_19_R1/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_19_R2/pom.xml b/spigot_1_19_R2/pom.xml
index 60a590a..0a3d03c 100644
--- a/spigot_1_19_R2/pom.xml
+++ b/spigot_1_19_R2/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_19_R3/pom.xml b/spigot_1_19_R3/pom.xml
index dd8342e..3a713e8 100644
--- a/spigot_1_19_R3/pom.xml
+++ b/spigot_1_19_R3/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_20_R1/pom.xml b/spigot_1_20_R1/pom.xml
index 122cc57..daf1c3c 100644
--- a/spigot_1_20_R1/pom.xml
+++ b/spigot_1_20_R1/pom.xml
@@ -10,7 +10,7 @@
me.tippie
customadvancements-parent
- 1.2.9
+ 1.2.10
diff --git a/spigot_1_20_R2/pom.xml b/spigot_1_20_R2/pom.xml
new file mode 100644
index 0000000..c166771
--- /dev/null
+++ b/spigot_1_20_R2/pom.xml
@@ -0,0 +1,116 @@
+
+
+ 4.0.0
+
+ customadvancements-spigot_1_20_R2
+ ${project.parent.version}
+ jar
+
+ me.tippie
+ customadvancements-parent
+ 1.2.10
+
+
+
+ 17
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+ net.md-5
+ specialsource-maven-plugin
+ 1.2.4
+
+
+ package
+
+ remap
+
+ remap-obf
+
+ org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:txt:maps-mojang
+ true
+ org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-mojang
+ true
+ remapped-obf
+
+
+
+ package
+
+ remap
+
+ remap-spigot
+
+ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
+ org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:csrg:maps-spigot
+ org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-obf
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+
+
+
+ org.spigotmc
+ spigot
+ 1.20.2-R0.1-SNAPSHOT
+ remapped-mojang
+ provided
+
+
+ me.tippie
+ customadvancements-core
+ ${project.parent.version}
+ provided
+
+
+
diff --git a/spigot_1_20_R2/src/main/java/me/tippie/customadvancements/v1_20_R2.java b/spigot_1_20_R2/src/main/java/me/tippie/customadvancements/v1_20_R2.java
new file mode 100644
index 0000000..1935aa6
--- /dev/null
+++ b/spigot_1_20_R2/src/main/java/me/tippie/customadvancements/v1_20_R2.java
@@ -0,0 +1,449 @@
+package me.tippie.customadvancements;
+
+import io.netty.channel.ChannelDuplexHandler;
+import io.netty.channel.ChannelHandlerContext;
+import me.tippie.customadvancements.advancement.AdvancementTree;
+import me.tippie.customadvancements.advancement.CAdvancement;
+import me.tippie.customadvancements.advancement.InvalidAdvancementException;
+import me.tippie.customadvancements.advancement.PlayerOpenAdvancementTabEvent;
+import me.tippie.customadvancements.advancement.requirement.AdvancementRequirement;
+import me.tippie.customadvancements.player.CAPlayer;
+import net.minecraft.advancements.*;
+import net.minecraft.advancements.critereon.ImpossibleTrigger;
+import net.minecraft.network.Connection;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.protocol.game.ClientboundUpdateAdvancementsPacket;
+import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.network.ServerCommonPacketListenerImpl;
+import net.minecraft.server.network.ServerGamePacketListenerImpl;
+import org.bukkit.Bukkit;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
+import org.bukkit.entity.Player;
+import org.checkerframework.checker.units.qual.A;
+
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+
+public class v1_20_R2 implements InternalsProvider {
+ private static final HashSet loadedTrees = new HashSet<>();
+ private static final HashMap advancements = new HashMap<>();
+ private static final HashMap> playerProgress = new HashMap<>();
+
+ @Override
+ public List getTreeFriendlyListList(Collection advancements) {
+ List result = new ArrayList<>(advancements.size());
+
+ // Add all the advancements and its children after the parent is added so
+ for (AdvancementNode advancement : advancements) {
+ if (result.contains(advancement)) continue;
+ if (advancement.parent() == null) {
+ result.add(advancement);
+ addChildren(advancement, result);
+ }
+ }
+
+ // Add all orphan advancements.. Hopefully their parents are already sent to the client....
+ for (AdvancementNode advancement : advancements) {
+ if (!result.contains(advancement)) {
+ result.add(advancement);
+ addChildren(advancement, result);
+ }
+ }
+
+ return result;
+ }
+
+ private void addChildren(AdvancementNode adv, List list) {
+ for (AdvancementNode child : adv.children()) {
+ if (!list.contains(child)) {
+ list.add(child);
+ addChildren(child, list);
+ }
+ }
+ }
+
+ @Override
+ public CompletableFuture loadAdvancements(List trees) {
+ return CompletableFuture.runAsync(() -> {
+ loadedTrees.clear();
+ advancements.clear();
+ playerProgress.clear();
+
+ for (AdvancementTree tree : trees) {
+ ResourceLocation rootLocation = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/root");
+ AdvancementHolder rootHolder = Advancement.Builder.advancement()
+ .display(CraftItemStack.asNMSCopy(tree.getOptions().getDisplayItem()),
+ Component.literal(tree.getOptions().getDisplayName() == null ? tree.getLabel() : tree.getOptions().getDisplayName()),
+ Component.literal(tree.getOptions().getDescription() == null ? "No Description Set" : tree.getOptions().getDescription()),
+ ResourceLocation.tryParse(tree.getOptions().getMinecraftGuiBackground()),
+ FrameType.TASK,
+ false,
+ false,
+ false)
+ .addCriterion("0", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()))
+ .requirements(AdvancementRequirements.Strategy.AND.create(Collections.singletonList("0")))
+ .build(rootLocation);
+ AdvancementNode root = new AdvancementNode(rootHolder, null);
+
+
+ advancements.put(rootLocation, root);
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+
+
+ Advancement.Builder builder = Advancement.Builder.advancement()
+ .display(CraftItemStack.asNMSCopy(cAdvancement.getDisplayItem()),
+ Component.literal(cAdvancement.getDisplayName() == null ? cAdvancement.getLabel() : cAdvancement.getDisplayName()),
+ Component.literal(cAdvancement.getDescription() == null ? "No Description Set" : cAdvancement.getDescription(null)),
+ null,
+ getFrameType(cAdvancement.getMinecraftGuiFrame().getValue()),
+ false,
+ cAdvancement.isMinecraftChatAnnounce(),
+ cAdvancement.isHidden());
+
+
+ List requirements;
+
+ switch (cAdvancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ requirements = new ArrayList<>(cAdvancement.getMaxProgress());
+ for (int i = 0; i < cAdvancement.getMaxProgress(); i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ case PERCENTAGE -> {
+ requirements = new ArrayList<>(100);
+ for (int i = 0; i < 100; i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ default -> {
+ requirements = new ArrayList<>(1);
+ for (int i = 0; i < 1; i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ }
+
+ builder.requirements(AdvancementRequirements.Strategy.AND.create(requirements));
+
+ advancements.put(location, new AdvancementNode(builder.build(location),null));
+ }
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+ AdvancementNode advancement = advancements.get(location);
+ AdvancementRequirement requirement = cAdvancement.getRequirements().stream()
+ .filter(req -> req.getType() instanceof me.tippie.customadvancements.advancement.requirement.types.Advancement)
+ .findFirst().orElse(null);
+
+ try {
+ if (requirement != null) {
+
+ try {
+ CAdvancement advancementRequirement = CustomAdvancements.getAdvancementManager().getAdvancement(requirement.getValue());
+ AdvancementNode parent = advancements.get(ResourceLocation.tryParse("customadvancements:" + advancementRequirement.getTree() + "/" + advancementRequirement.getLabel()));
+ if (parent != null) {
+ advancements.put(location, setParent(advancement, parent));
+ } else {
+ advancements.put(location, setParent(advancement,root));
+ }
+ } catch (InvalidAdvancementException e) {
+ advancements.put(location, setParent(advancement,root));
+
+ }
+ } else {
+ advancements.put(location, setParent(advancement,root));
+ }
+ } catch (RuntimeException e) {
+ CustomAdvancements.getInstance().getLogger().log(Level.SEVERE, "Failed to set put back advancement when setting the parent of " + location + " of tree " + tree.getLabel() + " and advancement " + cAdvancement.getLabel(),e);
+ }
+ }
+ loadedTrees.add(tree);
+
+ TreeNodePosition.run(root);
+ }
+
+ });
+ }
+
+ @Override
+ public CompletableFuture sendAdvancements(Player player, boolean clear) {
+ return CompletableFuture.runAsync(() -> {
+ playerProgress.computeIfAbsent(player.getUniqueId(), uuid -> createProgress());
+ HashMap progress = playerProgress.get(player.getUniqueId());
+ CAPlayer caPlayer = CustomAdvancements.getCaPlayerManager().getPlayer(player.getUniqueId());
+
+ Collection sending = new HashSet<>(advancements.values());
+
+ for (AdvancementTree tree : loadedTrees) {
+ for (CAdvancement advancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + advancement.getLabel());
+ AdvancementNode adv = advancements.get(location);
+ DisplayInfo displayInfo = adv.advancement().display().orElseThrow();
+
+ sending.remove(adv);
+ AdvancementHolder updatedAdvHolder =deconstructAdvancement(adv.advancement()).display(
+ displayInfo.getIcon(),
+ displayInfo.getTitle(),
+ Component.literal(advancement.getDescription(player)),
+ displayInfo.getBackground(),
+ displayInfo.getFrame(),
+ !advancement.isAnnounced(player) && advancement.isMinecraftToast(),
+ displayInfo.shouldAnnounceChat(),
+ displayInfo.isHidden()
+ ).parent(adv.parent().holder()).build(location);
+ AdvancementNode updatedAdv = new AdvancementNode(updatedAdvHolder, adv.parent());
+ updatedAdv.advancement().display().orElseThrow().setLocation(displayInfo.getX(), displayInfo.getY());
+ sending.add(updatedAdv);
+ AdvancementProgress advancementProgress = progress.get(location);
+ Optional progressText = advancementProgress.getProgressText() == null ? Optional.empty() : Optional.of(advancementProgress.getProgressText().getString());
+ int done = progressText.map(s -> Integer.parseInt(s.split("/")[0])).orElseGet(() -> (advancementProgress.isDone() ? 1 : 0));
+
+ try {
+ int diff;
+
+ switch (advancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ diff = caPlayer.getProgress(advancement.getPath()) - done;
+ }
+ case PERCENTAGE -> {
+ diff = caPlayer.getProgress(advancement.getPath()) / advancement.getMaxProgress() - done;
+ }
+ default -> {
+ diff = (caPlayer.getProgress(advancement.getPath()) >= advancement.getMaxProgress() ? 1 : 0) - done;
+ }
+ }
+ if (diff < 0) {
+ for (int i = done; i > caPlayer.getProgress(advancement.getPath()); i--)
+ advancementProgress.revokeProgress(String.valueOf(i - 1));
+
+ } else if (diff > 0) {
+
+ for (int i = done; i < caPlayer.getProgress(advancement.getPath()); i++)
+ advancementProgress.grantProgress(String.valueOf(i));
+ }
+ } catch (InvalidAdvancementException ignored) {
+ }
+ }
+ }
+
+ sendAdvancementPacket(player, clear, sending, new HashSet<>(), progress).join();
+ });
+ }
+
+ @Override
+ public CompletableFuture updateAdvancement(Player player, CAdvancement... advancements) {
+ return CompletableFuture.runAsync(() -> {
+
+ playerProgress.computeIfAbsent(player.getUniqueId(), uuid -> createProgress());
+ HashMap progress = playerProgress.get(player.getUniqueId());
+ CAPlayer caPlayer = CustomAdvancements.getCaPlayerManager().getPlayer(player.getUniqueId());
+ Map updating = new HashMap<>();
+ Map sending = new HashMap<>();
+
+ for (CAdvancement advancement : advancements) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + advancement.getTree() + "/" + advancement.getLabel());
+ AdvancementProgress advancementProgress = progress.get(location);
+ Optional progressText = advancementProgress.getProgressText() == null ? Optional.empty() : Optional.of(advancementProgress.getProgressText().getString());
+ int done = progressText.map(s -> Integer.parseInt(s.split("/")[0])).orElseGet(() -> (advancementProgress.isDone() ? 1 : 0));
+
+ try {
+ int diff;
+
+ switch (advancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ diff = caPlayer.getProgress(advancement.getPath()) - done;
+ }
+ case PERCENTAGE -> {
+ diff = caPlayer.getProgress(advancement.getPath()) / advancement.getMaxProgress() - done;
+ }
+ default -> {
+ diff = (caPlayer.getProgress(advancement.getPath()) >= advancement.getMaxProgress() ? 1 : 0) - done;
+ }
+ }
+ if (diff < 0) {
+ for (int i = done; i > caPlayer.getProgress(advancement.getPath()); i--)
+ advancementProgress.revokeProgress(String.valueOf(i - 1));
+
+ } else if (diff > 0) {
+ for (int i = done; i < caPlayer.getProgress(advancement.getPath()); i++)
+ advancementProgress.grantProgress(String.valueOf(i));
+ }
+
+ if (true) {
+ updating.put(location, advancementProgress);
+ AdvancementNode adv = v1_20_R2.advancements.get(location);
+ DisplayInfo displayInfo = adv.advancement().display().orElseThrow();
+ AdvancementHolder updatedAdvHolder = deconstructAdvancement(adv.advancement()).display(
+ displayInfo.getIcon(),
+ displayInfo.getTitle(),
+ Component.literal(advancement.getDescription(player)),
+ displayInfo.getBackground(),
+ displayInfo.getFrame(),
+ !advancement.isAnnounced(player) && advancement.isMinecraftToast(),
+ displayInfo.shouldAnnounceChat(),
+ displayInfo.isHidden()
+ ).parent(adv.parent().holder()).build(location);
+ AdvancementNode updatedAdv = new AdvancementNode(updatedAdvHolder, adv.parent());
+ updatedAdv.advancement().display().orElseThrow().setLocation(displayInfo.getX(), displayInfo.getY());
+ sending.put(location, updatedAdv);
+ }
+ } catch (InvalidAdvancementException ignored) {
+ }
+
+ }
+
+
+ sendAdvancementPacket(player, false, sending.values(), sending.keySet(), updating).join();
+ });
+ }
+
+ @Override
+ public void registerAdvancementTabListener(Player player) {
+
+ // Use reflection to get newly private net.minecraft.server.network.ServerGamePacketListenerImpl.connection
+ Field nettyConnectionField;
+ try {
+ // noinspection JavaReflectionMemberAccess
+ nettyConnectionField = ServerCommonPacketListenerImpl.class.getDeclaredField("c"); // obf 'connection'
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ nettyConnectionField.setAccessible(true);
+
+ ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
+ Connection minecraftConnection;
+ try {
+ minecraftConnection = (Connection) nettyConnectionField.get(connection);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+
+ minecraftConnection.channel.pipeline().addBefore("packet_handler", "advancement_tab_handler", new ChannelDuplexHandler() {
+ @Override
+ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+
+ if (msg instanceof ServerboundSeenAdvancementsPacket packet) {
+ PlayerOpenAdvancementTabEvent.Action action =
+ packet.getAction().equals(ServerboundSeenAdvancementsPacket.Action.OPENED_TAB) ?
+ PlayerOpenAdvancementTabEvent.Action.OPEN :
+ PlayerOpenAdvancementTabEvent.Action.CLOSE;
+
+ NamespacedKey key = packet.getTab() == null ? null : new NamespacedKey(packet.getTab().getNamespace(), packet.getTab().getPath());
+
+ PlayerOpenAdvancementTabEvent event = new PlayerOpenAdvancementTabEvent(player, action, key);
+ Bukkit.getPluginManager().callEvent(event);
+ }
+
+ super.channelRead(ctx, msg);
+ }
+ });
+ }
+
+ @Override
+ public CompletableFuture sendAdvancementPacketImpl(Player player, boolean clear, Collection advancements, Set remove, Map progress) {
+ return CompletableFuture.runAsync(() -> {
+ ClientboundUpdateAdvancementsPacket packet = new ClientboundUpdateAdvancementsPacket(clear, advancements.stream().map(AdvancementNode::holder).toList(), remove, progress);
+ ((CraftPlayer) player).getHandle().connection.send(packet);
+ });
+ }
+
+ @Override
+ public String getResourceLocationOfAdvancement(AdvancementNode advancement) {
+ return advancement.holder().id().toString();
+ }
+
+ @Override
+ public String getResourceLocationOfNms(ResourceLocation location) {
+ return location.toString();
+ }
+
+ @Override
+ public ResourceLocation getNmsLocationFromString(String location) {
+ return ResourceLocation.tryParse(location);
+ }
+
+ private FrameType getFrameType(String frame) {
+ return switch (frame.toLowerCase()) {
+ case "task" -> FrameType.TASK;
+ case "challenge" -> FrameType.CHALLENGE;
+ case "goal" -> FrameType.GOAL;
+ default -> throw new IllegalArgumentException("Frame type must be one of [task, challenge, goal]!");
+ };
+ }
+
+ private HashMap createProgress() {
+ HashMap result = new HashMap<>();
+ for (AdvancementTree tree : loadedTrees) {
+ ResourceLocation rootLocation = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/root");
+
+
+ AdvancementProgress rootProgress = new AdvancementProgress();
+
+
+// Map> criterion = new HashMap<>();
+// criterion.put("0", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+
+ rootProgress.update(AdvancementRequirements.Strategy.AND.create(Collections.singletonList("0")));
+ rootProgress.grantProgress("0");
+
+ result.put(rootLocation, rootProgress);
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+
+ AdvancementProgress advancementProgress = new AdvancementProgress();
+// Map aCriterion = new HashMap<>();
+ List aRequirements = new ArrayList<>(cAdvancement.getMaxProgress());
+
+ for (int i = 0; i < cAdvancement.getMaxProgress(); i++) {
+// aCriterion.put(String.valueOf(i), new Criterion(new ImpossibleTrigger.TriggerInstance()));
+ aRequirements.add(String.valueOf(i));
+ }
+
+ advancementProgress.update(AdvancementRequirements.Strategy.AND.create(aRequirements));
+ result.put(location, advancementProgress);
+ }
+ }
+ return result;
+ }
+
+ private AdvancementNode setParent(AdvancementNode advancement, AdvancementNode parent) {
+ List children = new ArrayList<>();
+ for (AdvancementNode child : advancement.children())
+ children.add(child);
+
+ try {
+ AdvancementHolder newAdvancementHolder = deconstructAdvancement(advancement.advancement()).parent(parent.holder()).build(advancement.holder().id());
+ AdvancementNode newAdvancement = new AdvancementNode(newAdvancementHolder, parent);
+
+ for (AdvancementNode child : children)
+ newAdvancement.addChild(child);
+
+ parent.addChild(newAdvancement);
+ return newAdvancement;
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to set parent of advancement.", e);
+ }
+ }
+
+ private Advancement.Builder deconstructAdvancement(Advancement advancement) {
+ Advancement.Builder builder = Advancement.Builder.advancement();
+ if (advancement.display().isPresent())
+ builder.display(advancement.display().get());
+ for (Map.Entry> entry : advancement.criteria().entrySet())
+ builder.addCriterion(entry.getKey(), entry.getValue());
+ builder.requirements(advancement.requirements());
+ return builder;
+ }
+}
diff --git a/spigot_1_20_R3/pom.xml b/spigot_1_20_R3/pom.xml
new file mode 100644
index 0000000..c192ec8
--- /dev/null
+++ b/spigot_1_20_R3/pom.xml
@@ -0,0 +1,116 @@
+
+
+ 4.0.0
+
+ customadvancements-spigot_1_20_R3
+ ${project.parent.version}
+ jar
+
+ me.tippie
+ customadvancements-parent
+ 1.2.10
+
+
+
+ 17
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+ net.md-5
+ specialsource-maven-plugin
+ 1.2.4
+
+
+ package
+
+ remap
+
+ remap-obf
+
+ org.spigotmc:minecraft-server:1.20.3-R0.1-SNAPSHOT:txt:maps-mojang
+ true
+ org.spigotmc:spigot:1.20.3-R0.1-SNAPSHOT:jar:remapped-mojang
+ true
+ remapped-obf
+
+
+
+ package
+
+ remap
+
+ remap-spigot
+
+ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
+ org.spigotmc:minecraft-server:1.20.3-R0.1-SNAPSHOT:csrg:maps-spigot
+ org.spigotmc:spigot:1.20.3-R0.1-SNAPSHOT:jar:remapped-obf
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+
+
+
+ org.spigotmc
+ spigot
+ 1.20.3-R0.1-SNAPSHOT
+ remapped-mojang
+ provided
+
+
+ me.tippie
+ customadvancements-core
+ ${project.parent.version}
+ provided
+
+
+
diff --git a/spigot_1_20_R3/src/main/java/me/tippie/customadvancements/v1_20_R3.java b/spigot_1_20_R3/src/main/java/me/tippie/customadvancements/v1_20_R3.java
new file mode 100644
index 0000000..48c4e67
--- /dev/null
+++ b/spigot_1_20_R3/src/main/java/me/tippie/customadvancements/v1_20_R3.java
@@ -0,0 +1,448 @@
+package me.tippie.customadvancements;
+
+import io.netty.channel.ChannelDuplexHandler;
+import io.netty.channel.ChannelHandlerContext;
+import me.tippie.customadvancements.advancement.AdvancementTree;
+import me.tippie.customadvancements.advancement.CAdvancement;
+import me.tippie.customadvancements.advancement.InvalidAdvancementException;
+import me.tippie.customadvancements.advancement.PlayerOpenAdvancementTabEvent;
+import me.tippie.customadvancements.advancement.requirement.AdvancementRequirement;
+import me.tippie.customadvancements.player.CAPlayer;
+import net.minecraft.advancements.*;
+import net.minecraft.advancements.critereon.ImpossibleTrigger;
+import net.minecraft.network.Connection;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.protocol.game.ClientboundUpdateAdvancementsPacket;
+import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.network.ServerCommonPacketListenerImpl;
+import net.minecraft.server.network.ServerGamePacketListenerImpl;
+import org.bukkit.Bukkit;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
+import org.bukkit.entity.Player;
+
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+
+public class v1_20_R3 implements InternalsProvider {
+ private static final HashSet loadedTrees = new HashSet<>();
+ private static final HashMap advancements = new HashMap<>();
+ private static final HashMap> playerProgress = new HashMap<>();
+
+ @Override
+ public List getTreeFriendlyListList(Collection advancements) {
+ List result = new ArrayList<>(advancements.size());
+
+ // Add all the advancements and its children after the parent is added so
+ for (AdvancementNode advancement : advancements) {
+ if (result.contains(advancement)) continue;
+ if (advancement.parent() == null) {
+ result.add(advancement);
+ addChildren(advancement, result);
+ }
+ }
+
+ // Add all orphan advancements.. Hopefully their parents are already sent to the client....
+ for (AdvancementNode advancement : advancements) {
+ if (!result.contains(advancement)) {
+ result.add(advancement);
+ addChildren(advancement, result);
+ }
+ }
+
+ return result;
+ }
+
+ private void addChildren(AdvancementNode adv, List list) {
+ for (AdvancementNode child : adv.children()) {
+ if (!list.contains(child)) {
+ list.add(child);
+ addChildren(child, list);
+ }
+ }
+ }
+
+ @Override
+ public CompletableFuture loadAdvancements(List trees) {
+ return CompletableFuture.runAsync(() -> {
+ loadedTrees.clear();
+ advancements.clear();
+ playerProgress.clear();
+
+ for (AdvancementTree tree : trees) {
+ ResourceLocation rootLocation = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/root");
+ AdvancementHolder rootHolder = Advancement.Builder.advancement()
+ .display(CraftItemStack.asNMSCopy(tree.getOptions().getDisplayItem()),
+ Component.literal(tree.getOptions().getDisplayName() == null ? tree.getLabel() : tree.getOptions().getDisplayName()),
+ Component.literal(tree.getOptions().getDescription() == null ? "No Description Set" : tree.getOptions().getDescription()),
+ ResourceLocation.tryParse(tree.getOptions().getMinecraftGuiBackground()),
+ AdvancementType.TASK,
+ false,
+ false,
+ false)
+ .addCriterion("0", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()))
+ .requirements(AdvancementRequirements.Strategy.AND.create(Collections.singletonList("0")))
+ .build(rootLocation);
+ AdvancementNode root = new AdvancementNode(rootHolder, null);
+
+
+ advancements.put(rootLocation, root);
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+
+
+ Advancement.Builder builder = Advancement.Builder.advancement()
+ .display(CraftItemStack.asNMSCopy(cAdvancement.getDisplayItem()),
+ Component.literal(cAdvancement.getDisplayName() == null ? cAdvancement.getLabel() : cAdvancement.getDisplayName()),
+ Component.literal(cAdvancement.getDescription() == null ? "No Description Set" : cAdvancement.getDescription(null)),
+ null,
+ getFrameType(cAdvancement.getMinecraftGuiFrame().getValue()),
+ false,
+ cAdvancement.isMinecraftChatAnnounce(),
+ cAdvancement.isHidden());
+
+
+ List requirements;
+
+ switch (cAdvancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ requirements = new ArrayList<>(cAdvancement.getMaxProgress());
+ for (int i = 0; i < cAdvancement.getMaxProgress(); i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ case PERCENTAGE -> {
+ requirements = new ArrayList<>(100);
+ for (int i = 0; i < 100; i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ default -> {
+ requirements = new ArrayList<>(1);
+ for (int i = 0; i < 1; i++) {
+ builder.addCriterion(String.valueOf(i), new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+ requirements.add(String.valueOf(i));
+ }
+ }
+ }
+
+ builder.requirements(AdvancementRequirements.Strategy.AND.create(requirements));
+
+ advancements.put(location, new AdvancementNode(builder.build(location),null));
+ }
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+ AdvancementNode advancement = advancements.get(location);
+ AdvancementRequirement requirement = cAdvancement.getRequirements().stream()
+ .filter(req -> req.getType() instanceof me.tippie.customadvancements.advancement.requirement.types.Advancement)
+ .findFirst().orElse(null);
+
+ try {
+ if (requirement != null) {
+
+ try {
+ CAdvancement advancementRequirement = CustomAdvancements.getAdvancementManager().getAdvancement(requirement.getValue());
+ AdvancementNode parent = advancements.get(ResourceLocation.tryParse("customadvancements:" + advancementRequirement.getTree() + "/" + advancementRequirement.getLabel()));
+ if (parent != null) {
+ advancements.put(location, setParent(advancement, parent));
+ } else {
+ advancements.put(location, setParent(advancement,root));
+ }
+ } catch (InvalidAdvancementException e) {
+ advancements.put(location, setParent(advancement,root));
+
+ }
+ } else {
+ advancements.put(location, setParent(advancement,root));
+ }
+ } catch (RuntimeException e) {
+ CustomAdvancements.getInstance().getLogger().log(Level.SEVERE, "Failed to set put back advancement when setting the parent of " + location + " of tree " + tree.getLabel() + " and advancement " + cAdvancement.getLabel(),e);
+ }
+ }
+ loadedTrees.add(tree);
+
+ TreeNodePosition.run(root);
+ }
+
+ });
+ }
+
+ @Override
+ public CompletableFuture sendAdvancements(Player player, boolean clear) {
+ return CompletableFuture.runAsync(() -> {
+ playerProgress.computeIfAbsent(player.getUniqueId(), uuid -> createProgress());
+ HashMap progress = playerProgress.get(player.getUniqueId());
+ CAPlayer caPlayer = CustomAdvancements.getCaPlayerManager().getPlayer(player.getUniqueId());
+
+ Collection sending = new HashSet<>(advancements.values());
+
+ for (AdvancementTree tree : loadedTrees) {
+ for (CAdvancement advancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + advancement.getLabel());
+ AdvancementNode adv = advancements.get(location);
+ DisplayInfo displayInfo = adv.advancement().display().orElseThrow();
+
+ sending.remove(adv);
+ AdvancementHolder updatedAdvHolder =deconstructAdvancement(adv.advancement()).display(
+ displayInfo.getIcon(),
+ displayInfo.getTitle(),
+ Component.literal(advancement.getDescription(player)),
+ displayInfo.getBackground().orElseGet(null),
+ displayInfo.getType(),
+ !advancement.isAnnounced(player) && advancement.isMinecraftToast(),
+ displayInfo.shouldAnnounceChat(),
+ displayInfo.isHidden()
+ ).build(location);
+ AdvancementNode updatedAdv = new AdvancementNode(updatedAdvHolder, adv.parent());
+ updatedAdv.advancement().display().orElseThrow().setLocation(displayInfo.getX(), displayInfo.getY());
+ sending.add(updatedAdv);
+ AdvancementProgress advancementProgress = progress.get(location);
+ Optional progressText = advancementProgress.getProgressText() == null ? Optional.empty() : Optional.of(advancementProgress.getProgressText().getString());
+ int done = progressText.map(s -> Integer.parseInt(s.split("/")[0])).orElseGet(() -> (advancementProgress.isDone() ? 1 : 0));
+
+ try {
+ int diff;
+
+ switch (advancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ diff = caPlayer.getProgress(advancement.getPath()) - done;
+ }
+ case PERCENTAGE -> {
+ diff = caPlayer.getProgress(advancement.getPath()) / advancement.getMaxProgress() - done;
+ }
+ default -> {
+ diff = (caPlayer.getProgress(advancement.getPath()) >= advancement.getMaxProgress() ? 1 : 0) - done;
+ }
+ }
+ if (diff < 0) {
+ for (int i = done; i > caPlayer.getProgress(advancement.getPath()); i--)
+ advancementProgress.revokeProgress(String.valueOf(i - 1));
+
+ } else if (diff > 0) {
+
+ for (int i = done; i < caPlayer.getProgress(advancement.getPath()); i++)
+ advancementProgress.grantProgress(String.valueOf(i));
+ }
+ } catch (InvalidAdvancementException ignored) {
+ }
+ }
+ }
+
+ sendAdvancementPacket(player, clear, sending, new HashSet<>(), progress).join();
+ });
+ }
+
+ @Override
+ public CompletableFuture updateAdvancement(Player player, CAdvancement... advancements) {
+ return CompletableFuture.runAsync(() -> {
+
+ playerProgress.computeIfAbsent(player.getUniqueId(), uuid -> createProgress());
+ HashMap progress = playerProgress.get(player.getUniqueId());
+ CAPlayer caPlayer = CustomAdvancements.getCaPlayerManager().getPlayer(player.getUniqueId());
+ Map updating = new HashMap<>();
+ Map sending = new HashMap<>();
+
+ for (CAdvancement advancement : advancements) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + advancement.getTree() + "/" + advancement.getLabel());
+ AdvancementProgress advancementProgress = progress.get(location);
+ Optional progressText = advancementProgress.getProgressText() == null ? Optional.empty() : Optional.of(advancementProgress.getProgressText().getString());
+ int done = progressText.map(s -> Integer.parseInt(s.split("/")[0])).orElseGet(() -> (advancementProgress.isDone() ? 1 : 0));
+
+ try {
+ int diff;
+
+ switch (advancement.getMinecraftProgressType()) {
+ case COUNT -> {
+ diff = caPlayer.getProgress(advancement.getPath()) - done;
+ }
+ case PERCENTAGE -> {
+ diff = caPlayer.getProgress(advancement.getPath()) / advancement.getMaxProgress() - done;
+ }
+ default -> {
+ diff = (caPlayer.getProgress(advancement.getPath()) >= advancement.getMaxProgress() ? 1 : 0) - done;
+ }
+ }
+ if (diff < 0) {
+ for (int i = done; i > caPlayer.getProgress(advancement.getPath()); i--)
+ advancementProgress.revokeProgress(String.valueOf(i - 1));
+
+ } else if (diff > 0) {
+ for (int i = done; i < caPlayer.getProgress(advancement.getPath()); i++)
+ advancementProgress.grantProgress(String.valueOf(i));
+ }
+
+ if (true) {
+ updating.put(location, advancementProgress);
+ AdvancementNode adv = v1_20_R3.advancements.get(location);
+ DisplayInfo displayInfo = adv.advancement().display().orElseThrow();
+ AdvancementHolder updatedAdvHolder = deconstructAdvancement(adv.advancement()).display(
+ displayInfo.getIcon(),
+ displayInfo.getTitle(),
+ Component.literal(advancement.getDescription(player)),
+ displayInfo.getBackground().orElseGet(null),
+ displayInfo.getType(),
+ !advancement.isAnnounced(player) && advancement.isMinecraftToast(),
+ displayInfo.shouldAnnounceChat(),
+ displayInfo.isHidden()
+ ).build(location);
+ AdvancementNode updatedAdv = new AdvancementNode(updatedAdvHolder, adv.parent());
+ updatedAdv.advancement().display().orElseThrow().setLocation(displayInfo.getX(), displayInfo.getY());
+ sending.put(location, updatedAdv);
+ }
+ } catch (InvalidAdvancementException ignored) {
+ }
+
+ }
+
+
+ sendAdvancementPacket(player, false, sending.values(), sending.keySet(), updating).join();
+ });
+ }
+
+ @Override
+ public void registerAdvancementTabListener(Player player) {
+
+ // Use reflection to get newly private net.minecraft.server.network.ServerGamePacketListenerImpl.connection
+ Field nettyConnectionField;
+ try {
+ // noinspection JavaReflectionMemberAccess
+ nettyConnectionField = ServerCommonPacketListenerImpl.class.getDeclaredField("c"); // obf 'connection'
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ nettyConnectionField.setAccessible(true);
+
+ ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
+ Connection minecraftConnection;
+ try {
+ minecraftConnection = (Connection) nettyConnectionField.get(connection);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+
+ minecraftConnection.channel.pipeline().addBefore("packet_handler", "advancement_tab_handler", new ChannelDuplexHandler() {
+ @Override
+ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+
+ if (msg instanceof ServerboundSeenAdvancementsPacket packet) {
+ PlayerOpenAdvancementTabEvent.Action action =
+ packet.getAction().equals(ServerboundSeenAdvancementsPacket.Action.OPENED_TAB) ?
+ PlayerOpenAdvancementTabEvent.Action.OPEN :
+ PlayerOpenAdvancementTabEvent.Action.CLOSE;
+
+ NamespacedKey key = packet.getTab() == null ? null : new NamespacedKey(packet.getTab().getNamespace(), packet.getTab().getPath());
+
+ PlayerOpenAdvancementTabEvent event = new PlayerOpenAdvancementTabEvent(player, action, key);
+ Bukkit.getPluginManager().callEvent(event);
+ }
+
+ super.channelRead(ctx, msg);
+ }
+ });
+ }
+
+ @Override
+ public CompletableFuture sendAdvancementPacketImpl(Player player, boolean clear, Collection advancements, Set remove, Map progress) {
+ return CompletableFuture.runAsync(() -> {
+ ClientboundUpdateAdvancementsPacket packet = new ClientboundUpdateAdvancementsPacket(clear, advancements.stream().map(AdvancementNode::holder).toList(), remove, progress);
+ ((CraftPlayer) player).getHandle().connection.send(packet);
+ });
+ }
+
+ @Override
+ public String getResourceLocationOfAdvancement(AdvancementNode advancement) {
+ return advancement.holder().id().toString();
+ }
+
+ @Override
+ public String getResourceLocationOfNms(ResourceLocation location) {
+ return location.toString();
+ }
+
+ @Override
+ public ResourceLocation getNmsLocationFromString(String location) {
+ return ResourceLocation.tryParse(location);
+ }
+
+ private AdvancementType getFrameType(String frame) {
+ return switch (frame.toLowerCase()) {
+ case "task" -> AdvancementType.TASK;
+ case "challenge" -> AdvancementType.CHALLENGE;
+ case "goal" -> AdvancementType.GOAL;
+ default -> throw new IllegalArgumentException("Frame type must be one of [task, challenge, goal]!");
+ };
+ }
+
+ private HashMap createProgress() {
+ HashMap result = new HashMap<>();
+ for (AdvancementTree tree : loadedTrees) {
+ ResourceLocation rootLocation = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/root");
+
+
+ AdvancementProgress rootProgress = new AdvancementProgress();
+
+
+// Map> criterion = new HashMap<>();
+// criterion.put("0", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance()));
+
+ rootProgress.update(AdvancementRequirements.Strategy.AND.create(Collections.singletonList("0")));
+ rootProgress.grantProgress("0");
+
+ result.put(rootLocation, rootProgress);
+
+ for (CAdvancement cAdvancement : tree.getAdvancements()) {
+ ResourceLocation location = ResourceLocation.tryParse("customadvancements:" + tree.getLabel() + "/" + cAdvancement.getLabel());
+
+ AdvancementProgress advancementProgress = new AdvancementProgress();
+// Map aCriterion = new HashMap<>();
+ List aRequirements = new ArrayList<>(cAdvancement.getMaxProgress());
+
+ for (int i = 0; i < cAdvancement.getMaxProgress(); i++) {
+// aCriterion.put(String.valueOf(i), new Criterion(new ImpossibleTrigger.TriggerInstance()));
+ aRequirements.add(String.valueOf(i));
+ }
+
+ advancementProgress.update(AdvancementRequirements.Strategy.AND.create(aRequirements));
+ result.put(location, advancementProgress);
+ }
+ }
+ return result;
+ }
+
+ private AdvancementNode setParent(AdvancementNode advancement, AdvancementNode parent) {
+ List children = new ArrayList<>();
+ for (AdvancementNode child : advancement.children())
+ children.add(child);
+
+ try {
+ AdvancementHolder newAdvancementHolder = deconstructAdvancement(advancement.advancement()).parent(parent.holder()).build(advancement.holder().id());
+ AdvancementNode newAdvancement = new AdvancementNode(newAdvancementHolder, parent);
+
+ for (AdvancementNode child : children)
+ newAdvancement.addChild(child);
+
+ parent.addChild(newAdvancement);
+ return newAdvancement;
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to set parent of advancement.", e);
+ }
+ }
+
+ private Advancement.Builder deconstructAdvancement(Advancement advancement) {
+ Advancement.Builder builder = Advancement.Builder.advancement();
+ if (advancement.display().isPresent())
+ builder.display(advancement.display().get());
+ for (Map.Entry> entry : advancement.criteria().entrySet())
+ builder.addCriterion(entry.getKey(), entry.getValue());
+ builder.requirements(advancement.requirements());
+ return builder;
+ }
+}