Skip to content

Commit

Permalink
feat: Add support for Minecraft 1.20.3/1.20.4 (#126)
Browse files Browse the repository at this point in the history
* docs: Minor comment tweak

* Prepare 1.20.3 support pending Velocity

* 1.20.3/1.20.4 & java 17 (#128)

* Improved PacketAdapter system + added support for 1.20.3/1.20.4

* Changed java version to 17, updated velocity dependencies, improved packet adapters & added support for 1.20.3/4.

* Fixed compile error with adventure

* deps: Bump `netty-codec-http` to 4.1.103

* ci: Upgrade dependabot config

* ci: Update CI & Docs with new requirements

* refactor: Rename `LUCK_PERMS_META` -> `LUCKPERMS_META`

* docs: Document `%luckperms_meta_(key)%`

---------

Co-authored-by: AlexDev_ <[email protected]>
  • Loading branch information
WiIIiam278 and alexdev03 authored Dec 14, 2023
1 parent d72ad28 commit f16dd54
Show file tree
Hide file tree
Showing 21 changed files with 170 additions and 226 deletions.
17 changes: 14 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

version: 2
updates:
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
# CI workflow action updates
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
commit-message:
prefix: "ci"

# Gradle package updates
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "deps"
35 changes: 20 additions & 15 deletions .github/workflows/java_ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builds, tests the project with Gradle
name: Java CI
# Builds, tests the project with Gradle and publishes to Modrinth & Hangar
name: CI Tests & Publish

on:
push:
Expand All @@ -11,32 +11,34 @@ on:

permissions:
contents: read
checks: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 16
uses: actions/setup-java@v3
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
- name: 'Set up JDK 17 📦'
uses: actions/setup-java@v4
with:
java-version: '16'
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
- name: 'Build with Gradle 🏗️'
uses: gradle/gradle-build-action@v2
with:
arguments: build test publish
arguments: build publish
env:
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Query Version
- name: 'Fetch Version Name 📝'
run: |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
id: fetch-version
- name: Get Version
run: |
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: Upload to Modrinth & Hangar
- name: 'Publish to Modrinth & Hangar 🧽'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: Q10irTG0
Expand All @@ -47,7 +49,7 @@ jobs:
hangar-token: ${{ secrets.HANGAR_API_KEY }}
hangar-version-type: Alpha
hangar-game-versions: |
3.2
3.3
files: target/Velocitab-*.jar
name: Velocitab v${{ env.version_name }}
version: ${{ env.version_name }}
Expand Down Expand Up @@ -100,9 +102,12 @@ jobs:
1.20
1.20.1
1.20.2
java: 16
- name: Upload GitHub Artifact
uses: actions/upload-artifact@v2
1.20.3
1.20.4
java: 17
- name: 'Upload GitHub Artifact 📦'
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Velocitab Plugin
name: Velocitab
path: target/Velocitab-*.jar
15 changes: 8 additions & 7 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Carry out tests on pull requests
name: PR Tests

on:
Expand All @@ -7,18 +6,20 @@ on:

permissions:
contents: read
checks: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 16
uses: actions/setup-java@v3
- name: 'Checkout for CI 🛎'
uses: actions/checkout@v4
- name: 'Set up JDK 17 📦'
uses: actions/setup-java@v4
with:
java-version: '16'
java-version: '17'
distribution: 'temurin'
- name: Test Pull Request
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
- name: 'Build with Gradle 🏗️'
uses: gradle/gradle-build-action@v2
with:
arguments: build
35 changes: 16 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,27 @@ on:

permissions:
contents: read
checks: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 16
uses: actions/setup-java@v3
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
- name: 'Set up JDK 17 📦'
uses: actions/setup-java@v4
with:
java-version: '16'
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
- name: 'Build with Gradle 🏗️'
uses: gradle/gradle-build-action@v2
with:
arguments: build test publish
arguments: build publish
env:
RELEASES_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
RELEASES_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Query Version
run: |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
id: fetch-version
- name: Get Version
run: |
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: Upload to Modrinth & Hangar
- name: 'Publish to Modrinth & Hangar 🚰'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: Q10irTG0
Expand All @@ -43,7 +38,7 @@ jobs:
hangar-token: ${{ secrets.HANGAR_API_KEY }}
hangar-version-type: Release
hangar-game-versions: |
3.2
3.3
files: target/Velocitab-*.jar
name: Velocitab v${{ github.event.release.tag_name }}
version: ${{ github.event.release.tag_name }}
Expand Down Expand Up @@ -96,9 +91,11 @@ jobs:
1.20
1.20.1
1.20.2
java: 16
- name: Upload GitHub Artifact
uses: actions/upload-artifact@v2
1.20.3
1.20.4
java: 17
- name: 'Upload GitHub Artifacts 📦'
uses: actions/upload-artifact@v3
with:
name: Velocitab Plugin
name: Velocitab
path: target/Velocitab-*.jar
9 changes: 4 additions & 5 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Update the GitHub Wiki documentation when a push is made to docs/
name: Update Docs

on:
Expand All @@ -17,10 +16,10 @@ jobs:
deploy-wiki:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Code'
uses: actions/checkout@v3
- name: 'Push Changes to Wiki'
uses: Andrew-Chen-Wang/github-wiki-action@v3
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
- name: 'Push Docs to Github Wiki 📄️'
uses: Andrew-Chen-Wang/github-wiki-action@v4
env:
WIKI_DIR: 'docs/'
GH_TOKEN: ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--suppress ALL -->
<p align="center">
<img src="images/banner.png" alt="Velocitab" />
<a href="https://github.com/WiIIiam278/Velocitab/actions/workflows/java_ci.yml">
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/Velocitab/java_ci.yml?branch=master&logo=github"/>
<a href="https://github.com/WiIIiam278/Velocitab/actions/workflows/ci.yml">
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/Velocitab/ci.yml?branch=master&logo=github"/>
</a>
<a href="https://repo.william278.net/#/releases/net/william278/velocitab/">
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/velocitab?color=00fb9a&name=Maven&prefix=v" />
Expand Down
16 changes: 13 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ repositories {
maven { url = 'https://repo.minebench.de/' }
maven { url = 'https://maven.elytrium.net/repo/' }
maven { url = 'https://mvn.exceptionflug.de/repository/exceptionflug-public/' }
maven { url = 'https://repo.william278.net/velocity/' }
}

dependencies {
compileOnly 'com.velocitypowered:velocity-api:3.2.0-SNAPSHOT'
compileOnly 'com.velocitypowered:velocity-proxy:3.2.0-SNAPSHOT'
compileOnly ('com.velocitypowered:velocity-api:3.3.0-SNAPSHOT') {
exclude group: 'net.kyori'
}
compileOnly 'com.velocitypowered:velocity-proxy:3.3.0-SNAPSHOT'
compileOnly 'io.netty:netty-codec-http:4.1.103.Final'
compileOnly 'org.projectlombok:lombok:1.18.30'
compileOnly 'net.luckperms:api:5.4'
compileOnly 'io.github.miniplaceholders:miniplaceholders-api:2.0.0'
compileOnly 'net.william278:PAPIProxyBridge:1.4.2'
compileOnly 'it.unimi.dsi:fastutil:8.5.12'
compileOnly 'net.kyori:adventure-nbt:4.14.0'
compileOnly 'net.kyori:adventure-api:4.14.0'
compileOnly 'net.kyori:adventure-text-minimessage:4.14.0'
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.14.0'
compileOnly 'net.kyori:adventure-text-serializer-gson:4.14.0'


implementation 'org.apache.commons:commons-text:1.11.0'
Expand Down Expand Up @@ -72,6 +80,9 @@ javadoc.options.encoding = 'UTF-8'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')

java {
def javaVersion = JavaVersion.toVersion(javaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
withJavadocJar()
}
Expand All @@ -89,7 +100,6 @@ shadowJar {
relocate 'org.bstats', 'net.william278.velocitab.libraries.bstats'

dependencies {
//noinspection GroovyAssignabilityCheck
exclude dependency(':slf4j-api')
}

Expand Down
1 change: 1 addition & 0 deletions docs/Placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Placeholders can be included in the header, footer and player name format of the
| `%role%` | The player's primary LuckPerms group name | `admin` |
| `%role_display_name%` | The player's primary LuckPerms group display name | `Admin` |
| `%role_weight%` | Comparable-formatted primary LuckPerms group weight. | `100` |
| `%luckperms_meta_(key)%` | Formats a meta key from the user's LuckPerms group | (varies) |
| `%server_group%` | The name of the server group the player is on | `default` |
| `%server_group_index%` | Indexed order of the server group in the list | `0` |
| `%debug_team_name%` | (Debug) Player's team name, used for [[Sorting]] | `1alphaWilliam278` |
Expand Down
2 changes: 1 addition & 1 deletion docs/Setup.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This page will walk you through installing Velocitab on a Velocity proxy server.

## Requirements
* A Velocity proxy server (running Velocity 3.2.0 or newer)
* A Velocity proxy server (running Velocity 3.3.0 or newer)
* Backend Minecraft servers. The following Minecraft server versions are fully supported:
- Minecraft 1.8&mdash;1.8.9
- Minecraft 1.12.2&mdash;latest
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
javaVersion=16
javaVersion=17

org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* limitations under the License.
*/


package net.william278.velocitab.api;

import com.velocitypowered.api.proxy.Player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public enum Placeholder {
SERVER_GROUP((plugin, player) -> player.getServerGroup(plugin)),
SERVER_GROUP_INDEX((plugin, player) -> Integer.toString(player.getServerGroupPosition(plugin))),
DEBUG_TEAM_NAME((plugin, player) -> plugin.getFormatter().escape(player.getLastTeamName().orElse(""))),
LUCK_PERMS_META_((param, plugin, player) -> plugin.getLuckPermsHook().map(hook -> hook.getMeta(player.getPlayer(), param))
.orElse("")),
;
LUCKPERMS_META_((param, plugin, player) -> plugin.getLuckPermsHook()
.map(hook -> hook.getMeta(player.getPlayer(), param))
.orElse(""));

/**
* Function to replace placeholders with a real value
Expand Down
Loading

0 comments on commit f16dd54

Please sign in to comment.