forked from Upstream/Velocitab
feat: Add support for Minecraft 1.20.3/1.20.4 (#126)
* 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_ <56083016+alexdev03@users.noreply.github.com>
This commit is contained in:
parent
d72ad289ec
commit
f16dd54a7f
17
.github/dependabot.yml
vendored
17
.github/dependabot.yml
vendored
@ -2,7 +2,18 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "gradle" # See documentation for possible values
|
# CI workflow action updates
|
||||||
directory: "/" # Location of package manifests
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "weekly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci"
|
||||||
|
|
||||||
|
# Gradle package updates
|
||||||
|
- package-ecosystem: "gradle"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "deps"
|
@ -1,5 +1,5 @@
|
|||||||
# Builds, tests the project with Gradle
|
# Builds, tests the project with Gradle and publishes to Modrinth & Hangar
|
||||||
name: Java CI
|
name: CI Tests & Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -11,32 +11,34 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
checks: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: 'Checkout for CI 🛎️'
|
||||||
- name: Set up JDK 16
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-java@v3
|
- name: 'Set up JDK 17 📦'
|
||||||
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '16'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Build with Gradle
|
- name: 'Build with Gradle 🏗️'
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build test publish
|
arguments: build publish
|
||||||
env:
|
env:
|
||||||
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
- name: Query Version
|
- name: 'Fetch Version Name 📝'
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
||||||
id: fetch-version
|
id: fetch-version
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
run: |
|
run: |
|
||||||
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
|
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
|
uses: WiIIiam278/mc-publish@hangar
|
||||||
with:
|
with:
|
||||||
modrinth-id: Q10irTG0
|
modrinth-id: Q10irTG0
|
||||||
@ -47,7 +49,7 @@ jobs:
|
|||||||
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
||||||
hangar-version-type: Alpha
|
hangar-version-type: Alpha
|
||||||
hangar-game-versions: |
|
hangar-game-versions: |
|
||||||
3.2
|
3.3
|
||||||
files: target/Velocitab-*.jar
|
files: target/Velocitab-*.jar
|
||||||
name: Velocitab v${{ env.version_name }}
|
name: Velocitab v${{ env.version_name }}
|
||||||
version: ${{ env.version_name }}
|
version: ${{ env.version_name }}
|
||||||
@ -100,9 +102,12 @@ jobs:
|
|||||||
1.20
|
1.20
|
||||||
1.20.1
|
1.20.1
|
||||||
1.20.2
|
1.20.2
|
||||||
java: 16
|
1.20.3
|
||||||
- name: Upload GitHub Artifact
|
1.20.4
|
||||||
uses: actions/upload-artifact@v2
|
java: 17
|
||||||
|
- name: 'Upload GitHub Artifact 📦'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: success() || failure()
|
||||||
with:
|
with:
|
||||||
name: Velocitab Plugin
|
name: Velocitab
|
||||||
path: target/Velocitab-*.jar
|
path: target/Velocitab-*.jar
|
15
.github/workflows/pr_tests.yml
vendored
15
.github/workflows/pr_tests.yml
vendored
@ -1,4 +1,3 @@
|
|||||||
# Carry out tests on pull requests
|
|
||||||
name: PR Tests
|
name: PR Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -7,18 +6,20 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
checks: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: 'Checkout for CI 🛎'
|
||||||
- name: Set up JDK 16
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-java@v3
|
- name: 'Set up JDK 17 📦'
|
||||||
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '16'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Test Pull Request
|
- name: 'Build with Gradle 🏗️'
|
||||||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build
|
35
.github/workflows/release.yml
vendored
35
.github/workflows/release.yml
vendored
@ -7,32 +7,27 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
checks: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: 'Checkout for CI 🛎️'
|
||||||
- name: Set up JDK 16
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-java@v3
|
- name: 'Set up JDK 17 📦'
|
||||||
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '16'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Build with Gradle
|
- name: 'Build with Gradle 🏗️'
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build test publish
|
arguments: build publish
|
||||||
env:
|
env:
|
||||||
RELEASES_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
RELEASES_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
RELEASES_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
RELEASES_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
- name: Query Version
|
- name: 'Publish to Modrinth & Hangar 🚰'
|
||||||
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
|
|
||||||
uses: WiIIiam278/mc-publish@hangar
|
uses: WiIIiam278/mc-publish@hangar
|
||||||
with:
|
with:
|
||||||
modrinth-id: Q10irTG0
|
modrinth-id: Q10irTG0
|
||||||
@ -43,7 +38,7 @@ jobs:
|
|||||||
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
||||||
hangar-version-type: Release
|
hangar-version-type: Release
|
||||||
hangar-game-versions: |
|
hangar-game-versions: |
|
||||||
3.2
|
3.3
|
||||||
files: target/Velocitab-*.jar
|
files: target/Velocitab-*.jar
|
||||||
name: Velocitab v${{ github.event.release.tag_name }}
|
name: Velocitab v${{ github.event.release.tag_name }}
|
||||||
version: ${{ github.event.release.tag_name }}
|
version: ${{ github.event.release.tag_name }}
|
||||||
@ -96,9 +91,11 @@ jobs:
|
|||||||
1.20
|
1.20
|
||||||
1.20.1
|
1.20.1
|
||||||
1.20.2
|
1.20.2
|
||||||
java: 16
|
1.20.3
|
||||||
- name: Upload GitHub Artifact
|
1.20.4
|
||||||
uses: actions/upload-artifact@v2
|
java: 17
|
||||||
|
- name: 'Upload GitHub Artifacts 📦'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Velocitab Plugin
|
name: Velocitab
|
||||||
path: target/Velocitab-*.jar
|
path: target/Velocitab-*.jar
|
9
.github/workflows/update_docs.yml
vendored
9
.github/workflows/update_docs.yml
vendored
@ -1,4 +1,3 @@
|
|||||||
# Update the GitHub Wiki documentation when a push is made to docs/
|
|
||||||
name: Update Docs
|
name: Update Docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -17,10 +16,10 @@ jobs:
|
|||||||
deploy-wiki:
|
deploy-wiki:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Code'
|
- name: 'Checkout for CI 🛎️'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: 'Push Changes to Wiki'
|
- name: 'Push Docs to Github Wiki 📄️'
|
||||||
uses: Andrew-Chen-Wang/github-wiki-action@v3
|
uses: Andrew-Chen-Wang/github-wiki-action@v4
|
||||||
env:
|
env:
|
||||||
WIKI_DIR: 'docs/'
|
WIKI_DIR: 'docs/'
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<!--suppress ALL -->
|
<!--suppress ALL -->
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="images/banner.png" alt="Velocitab" />
|
<img src="images/banner.png" alt="Velocitab" />
|
||||||
<a href="https://github.com/WiIIiam278/Velocitab/actions/workflows/java_ci.yml">
|
<a href="https://github.com/WiIIiam278/Velocitab/actions/workflows/ci.yml">
|
||||||
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/Velocitab/java_ci.yml?branch=master&logo=github"/>
|
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/Velocitab/ci.yml?branch=master&logo=github"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://repo.william278.net/#/releases/net/william278/velocitab/">
|
<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" />
|
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/velocitab?color=00fb9a&name=Maven&prefix=v" />
|
||||||
|
16
build.gradle
16
build.gradle
@ -26,17 +26,25 @@ repositories {
|
|||||||
maven { url = 'https://repo.minebench.de/' }
|
maven { url = 'https://repo.minebench.de/' }
|
||||||
maven { url = 'https://maven.elytrium.net/repo/' }
|
maven { url = 'https://maven.elytrium.net/repo/' }
|
||||||
maven { url = 'https://mvn.exceptionflug.de/repository/exceptionflug-public/' }
|
maven { url = 'https://mvn.exceptionflug.de/repository/exceptionflug-public/' }
|
||||||
|
maven { url = 'https://repo.william278.net/velocity/' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.velocitypowered:velocity-api:3.2.0-SNAPSHOT'
|
compileOnly ('com.velocitypowered:velocity-api:3.3.0-SNAPSHOT') {
|
||||||
compileOnly 'com.velocitypowered:velocity-proxy:3.2.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 'io.netty:netty-codec-http:4.1.103.Final'
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.30'
|
compileOnly 'org.projectlombok:lombok:1.18.30'
|
||||||
compileOnly 'net.luckperms:api:5.4'
|
compileOnly 'net.luckperms:api:5.4'
|
||||||
compileOnly 'io.github.miniplaceholders:miniplaceholders-api:2.0.0'
|
compileOnly 'io.github.miniplaceholders:miniplaceholders-api:2.0.0'
|
||||||
compileOnly 'net.william278:PAPIProxyBridge:1.4.2'
|
compileOnly 'net.william278:PAPIProxyBridge:1.4.2'
|
||||||
compileOnly 'it.unimi.dsi:fastutil:8.5.12'
|
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'
|
implementation 'org.apache.commons:commons-text:1.11.0'
|
||||||
@ -72,6 +80,9 @@ javadoc.options.encoding = 'UTF-8'
|
|||||||
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
def javaVersion = JavaVersion.toVersion(javaVersion)
|
||||||
|
sourceCompatibility = javaVersion
|
||||||
|
targetCompatibility = javaVersion
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
}
|
}
|
||||||
@ -89,7 +100,6 @@ shadowJar {
|
|||||||
relocate 'org.bstats', 'net.william278.velocitab.libraries.bstats'
|
relocate 'org.bstats', 'net.william278.velocitab.libraries.bstats'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//noinspection GroovyAssignabilityCheck
|
|
||||||
exclude dependency(':slf4j-api')
|
exclude dependency(':slf4j-api')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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%` | The player's primary LuckPerms group name | `admin` |
|
||||||
| `%role_display_name%` | The player's primary LuckPerms group display name | `Admin` |
|
| `%role_display_name%` | The player's primary LuckPerms group display name | `Admin` |
|
||||||
| `%role_weight%` | Comparable-formatted primary LuckPerms group weight. | `100` |
|
| `%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%` | The name of the server group the player is on | `default` |
|
||||||
| `%server_group_index%` | Indexed order of the server group in the list | `0` |
|
| `%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` |
|
| `%debug_team_name%` | (Debug) Player's team name, used for [[Sorting]] | `1alphaWilliam278` |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
This page will walk you through installing Velocitab on a Velocity proxy server.
|
This page will walk you through installing Velocitab on a Velocity proxy server.
|
||||||
|
|
||||||
## Requirements
|
## 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:
|
* Backend Minecraft servers. The following Minecraft server versions are fully supported:
|
||||||
- Minecraft 1.8—1.8.9
|
- Minecraft 1.8—1.8.9
|
||||||
- Minecraft 1.12.2—latest
|
- Minecraft 1.12.2—latest
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
javaVersion=16
|
javaVersion=17
|
||||||
|
|
||||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.api;
|
package net.william278.velocitab.api;
|
||||||
|
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
@ -57,9 +57,9 @@ public enum Placeholder {
|
|||||||
SERVER_GROUP((plugin, player) -> player.getServerGroup(plugin)),
|
SERVER_GROUP((plugin, player) -> player.getServerGroup(plugin)),
|
||||||
SERVER_GROUP_INDEX((plugin, player) -> Integer.toString(player.getServerGroupPosition(plugin))),
|
SERVER_GROUP_INDEX((plugin, player) -> Integer.toString(player.getServerGroupPosition(plugin))),
|
||||||
DEBUG_TEAM_NAME((plugin, player) -> plugin.getFormatter().escape(player.getLastTeamName().orElse(""))),
|
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))
|
LUCKPERMS_META_((param, plugin, player) -> plugin.getLuckPermsHook()
|
||||||
.orElse("")),
|
.map(hook -> hook.getMeta(player.getPlayer(), param))
|
||||||
;
|
.orElse(""));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to replace placeholders with a real value
|
* Function to replace placeholders with a real value
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Velocitab, licensed under the Apache License 2.0.
|
|
||||||
*
|
|
||||||
* Copyright (c) William278 <will27528@gmail.com>
|
|
||||||
* Copyright (c) contributors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.packet;
|
|
||||||
|
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
|
||||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
|
||||||
import net.william278.velocitab.Velocitab;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.12.2
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
|
||||||
public class Protocol340Adapter extends TeamsPacketAdapter {
|
|
||||||
|
|
||||||
private final LegacyComponentSerializer serializer;
|
|
||||||
|
|
||||||
public Protocol340Adapter(@NotNull Velocitab plugin) {
|
|
||||||
super(plugin, Set.of(ProtocolVersion.MINECRAFT_1_12_2));
|
|
||||||
serializer = LegacyComponentSerializer.legacySection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet) {
|
|
||||||
ProtocolUtils.writeString(byteBuf, packet.teamName().substring(0, Math.min(packet.teamName().length(), 16)));
|
|
||||||
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
|
||||||
byteBuf.writeByte(mode.id());
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.REMOVE_TEAM) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
|
||||||
final String displayName = getChatString(packet.displayName());
|
|
||||||
final String prefix = getChatString(packet.prefix());
|
|
||||||
final String suffix = getChatString(packet.suffix());
|
|
||||||
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(displayName));
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(prefix));
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(suffix));
|
|
||||||
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
|
||||||
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
|
||||||
ProtocolUtils.writeString(byteBuf, packet.collisionRule().id());
|
|
||||||
byteBuf.writeByte(packet.color());
|
|
||||||
}
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
|
||||||
List<String> entities = packet.entities();
|
|
||||||
ProtocolUtils.writeVarInt(byteBuf, entities != null ? entities.size() : 0);
|
|
||||||
for (String entity : entities != null ? entities : new ArrayList<String>()) {
|
|
||||||
ProtocolUtils.writeString(byteBuf, entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a shortened version of the given string, with a maximum length of 16 characters.
|
|
||||||
* This is used to ensure that the team name, display name, prefix and suffix are not too long for the client.
|
|
||||||
* @param string the string to be shortened
|
|
||||||
* @return the shortened string
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
private String shrinkString(@NotNull String string) {
|
|
||||||
return string.substring(0, Math.min(string.length(), 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected String getChatString(@NotNull Component component) {
|
|
||||||
return serializer.serialize(component);
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.packet;
|
package net.william278.velocitab.packet;
|
||||||
|
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
@ -33,14 +32,13 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.13.2 - 1.15.2
|
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.13.2-1.15.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
public class Protocol404Adapter extends TeamsPacketAdapter {
|
public class Protocol404Adapter extends TeamsPacketAdapter {
|
||||||
|
|
||||||
private final GsonComponentSerializer serializer;
|
private final GsonComponentSerializer serializer;
|
||||||
|
|
||||||
|
|
||||||
public Protocol404Adapter(@NotNull Velocitab plugin) {
|
public Protocol404Adapter(@NotNull Velocitab plugin) {
|
||||||
super(plugin, Set.of(ProtocolVersion.MINECRAFT_1_13_2,
|
super(plugin, Set.of(ProtocolVersion.MINECRAFT_1_13_2,
|
||||||
ProtocolVersion.MINECRAFT_1_14,
|
ProtocolVersion.MINECRAFT_1_14,
|
||||||
@ -55,8 +53,13 @@ public class Protocol404Adapter extends TeamsPacketAdapter {
|
|||||||
serializer = GsonComponentSerializer.colorDownsamplingGson();
|
serializer = GsonComponentSerializer.colorDownsamplingGson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Protocol404Adapter(@NotNull Velocitab plugin, Set<ProtocolVersion> protocolVersions) {
|
||||||
|
super(plugin, protocolVersions);
|
||||||
|
serializer = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet) {
|
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet, @NotNull ProtocolVersion protocolVersion) {
|
||||||
ProtocolUtils.writeString(byteBuf, packet.teamName());
|
ProtocolUtils.writeString(byteBuf, packet.teamName());
|
||||||
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
||||||
byteBuf.writeByte(mode.id());
|
byteBuf.writeByte(mode.id());
|
||||||
@ -64,13 +67,13 @@ public class Protocol404Adapter extends TeamsPacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.displayName()));
|
writeComponent(byteBuf, packet.displayName());
|
||||||
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
||||||
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
||||||
ProtocolUtils.writeString(byteBuf, packet.collisionRule().id());
|
ProtocolUtils.writeString(byteBuf, packet.collisionRule().id());
|
||||||
byteBuf.writeByte(packet.color());
|
byteBuf.writeByte(packet.color());
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.prefix()));
|
writeComponent(byteBuf, packet.prefix());
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.suffix()));
|
writeComponent(byteBuf, packet.suffix());
|
||||||
}
|
}
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
||||||
List<String> entities = packet.entities();
|
List<String> entities = packet.entities();
|
||||||
@ -81,10 +84,8 @@ public class Protocol404Adapter extends TeamsPacketAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
protected void writeComponent(ByteBuf buf, Component component) {
|
||||||
@Override
|
ProtocolUtils.writeString(buf, serializer.serialize(component));
|
||||||
protected String getChatString(@NotNull Component component) {
|
|
||||||
return serializer.serialize(component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.packet;
|
package net.william278.velocitab.packet;
|
||||||
|
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
@ -41,12 +40,12 @@ public class Protocol48Adapter extends TeamsPacketAdapter {
|
|||||||
private final LegacyComponentSerializer serializer;
|
private final LegacyComponentSerializer serializer;
|
||||||
|
|
||||||
public Protocol48Adapter(@NotNull Velocitab plugin) {
|
public Protocol48Adapter(@NotNull Velocitab plugin) {
|
||||||
super(plugin, Set.of(ProtocolVersion.MINECRAFT_1_8));
|
super(plugin, Set.of(ProtocolVersion.MINECRAFT_1_8, ProtocolVersion.MINECRAFT_1_12_2));
|
||||||
serializer = LegacyComponentSerializer.legacySection();
|
serializer = LegacyComponentSerializer.legacySection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet) {
|
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet, @NotNull ProtocolVersion protocolVersion) {
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(packet.teamName()));
|
ProtocolUtils.writeString(byteBuf, shrinkString(packet.teamName()));
|
||||||
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
||||||
byteBuf.writeByte(mode.id());
|
byteBuf.writeByte(mode.id());
|
||||||
@ -54,15 +53,14 @@ public class Protocol48Adapter extends TeamsPacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
||||||
final String displayName = getChatString(packet.displayName());
|
writeComponent(byteBuf, packet.displayName());
|
||||||
final String prefix = getChatString(packet.prefix());
|
writeComponent(byteBuf, packet.prefix());
|
||||||
final String suffix = getChatString(packet.suffix());
|
writeComponent(byteBuf, packet.suffix());
|
||||||
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(displayName));
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(prefix));
|
|
||||||
ProtocolUtils.writeString(byteBuf, shrinkString(suffix));
|
|
||||||
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
||||||
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
||||||
|
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
|
||||||
|
ProtocolUtils.writeString(byteBuf, packet.collisionRule().id());
|
||||||
|
}
|
||||||
byteBuf.writeByte(packet.color());
|
byteBuf.writeByte(packet.color());
|
||||||
}
|
}
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
||||||
@ -85,9 +83,7 @@ public class Protocol48Adapter extends TeamsPacketAdapter {
|
|||||||
return string.substring(0, Math.min(string.length(), 16));
|
return string.substring(0, Math.min(string.length(), 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
protected void writeComponent(ByteBuf buf, Component component) {
|
||||||
@Override
|
ProtocolUtils.writeString(buf, shrinkString(serializer.serialize(component)));
|
||||||
protected String getChatString(@NotNull Component component) {
|
|
||||||
return serializer.serialize(component);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.packet;
|
package net.william278.velocitab.packet;
|
||||||
|
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
@ -28,15 +27,12 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
|||||||
import net.william278.velocitab.Velocitab;
|
import net.william278.velocitab.Velocitab;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.16 - 1.20.2
|
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.16-1.20.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("DuplicatedCode")
|
public class Protocol735Adapter extends Protocol404Adapter {
|
||||||
public class Protocol735Adapter extends TeamsPacketAdapter {
|
|
||||||
|
|
||||||
private final GsonComponentSerializer serializer;
|
private final GsonComponentSerializer serializer;
|
||||||
|
|
||||||
@ -62,35 +58,8 @@ public class Protocol735Adapter extends TeamsPacketAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet) {
|
protected void writeComponent(ByteBuf buf, Component component) {
|
||||||
ProtocolUtils.writeString(byteBuf, packet.teamName());
|
ProtocolUtils.writeString(buf, serializer.serialize(component));
|
||||||
UpdateTeamsPacket.UpdateMode mode = packet.mode();
|
|
||||||
byteBuf.writeByte(mode.id());
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.REMOVE_TEAM) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.UPDATE_INFO) {
|
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.displayName()));
|
|
||||||
byteBuf.writeByte(UpdateTeamsPacket.FriendlyFlag.toBitMask(packet.friendlyFlags()));
|
|
||||||
ProtocolUtils.writeString(byteBuf, packet.nametagVisibility().id());
|
|
||||||
ProtocolUtils.writeString(byteBuf, packet.collisionRule().id());
|
|
||||||
byteBuf.writeByte(packet.color());
|
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.prefix()));
|
|
||||||
ProtocolUtils.writeString(byteBuf, getChatString(packet.suffix()));
|
|
||||||
}
|
|
||||||
if (mode == UpdateTeamsPacket.UpdateMode.CREATE_TEAM || mode == UpdateTeamsPacket.UpdateMode.ADD_PLAYERS || mode == UpdateTeamsPacket.UpdateMode.REMOVE_PLAYERS) {
|
|
||||||
List<String> entities = packet.entities();
|
|
||||||
ProtocolUtils.writeVarInt(byteBuf, entities != null ? entities.size() : 0);
|
|
||||||
for (String entity : entities != null ? entities : new ArrayList<String>()) {
|
|
||||||
ProtocolUtils.writeString(byteBuf, entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
}
|
||||||
@Override
|
|
||||||
protected String getChatString(@NotNull Component component) {
|
|
||||||
return serializer.serialize(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Velocitab, licensed under the Apache License 2.0.
|
||||||
|
*
|
||||||
|
* Copyright (c) William278 <will27528@gmail.com>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.william278.velocitab.packet;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
|
import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.william278.velocitab.Velocitab;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter for handling the UpdateTeamsPacket for Minecraft 1.20.3-1.20.4
|
||||||
|
*/
|
||||||
|
public class Protocol765Adapter extends Protocol404Adapter {
|
||||||
|
|
||||||
|
public Protocol765Adapter(@NotNull Velocitab plugin) {
|
||||||
|
super(plugin, Set.of(
|
||||||
|
ProtocolVersion.MINECRAFT_1_20_3
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void writeComponent(ByteBuf buf, Component component) {
|
||||||
|
new ComponentHolder(ProtocolVersion.MINECRAFT_1_20_3, component).write(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -53,10 +53,14 @@ public class ScoreboardManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerVersions() {
|
private void registerVersions() {
|
||||||
versions.add(new Protocol735Adapter(plugin));
|
try {
|
||||||
versions.add(new Protocol404Adapter(plugin));
|
versions.add(new Protocol765Adapter(plugin));
|
||||||
versions.add(new Protocol340Adapter(plugin));
|
versions.add(new Protocol735Adapter(plugin));
|
||||||
versions.add(new Protocol48Adapter(plugin));
|
versions.add(new Protocol404Adapter(plugin));
|
||||||
|
versions.add(new Protocol48Adapter(plugin));
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
throw new IllegalStateException("Failed to register scoreboard packet adapters. Try to update velocity to latest build", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ -282,7 +286,8 @@ public class ScoreboardManager {
|
|||||||
.mapping(0x58, MINECRAFT_1_19_1, true)
|
.mapping(0x58, MINECRAFT_1_19_1, true)
|
||||||
.mapping(0x56, MINECRAFT_1_19_3, true)
|
.mapping(0x56, MINECRAFT_1_19_3, true)
|
||||||
.mapping(0x5A, MINECRAFT_1_19_4, true)
|
.mapping(0x5A, MINECRAFT_1_19_4, true)
|
||||||
.mapping(0x5C, MINECRAFT_1_20_2, true);
|
.mapping(0x5C, MINECRAFT_1_20_2, true)
|
||||||
|
.mapping(0x5E, MINECRAFT_1_20_3, true);
|
||||||
packetRegistration.register();
|
packetRegistration.register();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
plugin.log(Level.ERROR, "Failed to register UpdateTeamsPacket", e);
|
plugin.log(Level.ERROR, "Failed to register UpdateTeamsPacket", e);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package net.william278.velocitab.packet;
|
package net.william278.velocitab.packet;
|
||||||
|
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
@ -37,9 +36,8 @@ public abstract class TeamsPacketAdapter {
|
|||||||
private final Velocitab plugin;
|
private final Velocitab plugin;
|
||||||
private final Set<ProtocolVersion> protocolVersions;
|
private final Set<ProtocolVersion> protocolVersions;
|
||||||
|
|
||||||
public abstract void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet);
|
public abstract void encode(@NotNull ByteBuf byteBuf, @NotNull UpdateTeamsPacket packet, @NotNull ProtocolVersion protocolVersion);
|
||||||
|
|
||||||
@NotNull
|
protected abstract void writeComponent(ByteBuf buf, Component component);
|
||||||
protected abstract String getChatString(@NotNull Component component);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ public class UpdateTeamsPacket implements MinecraftPacket {
|
|||||||
if (optionalManager.isEmpty()) {
|
if (optionalManager.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
optionalManager.get().getPacketAdapter(protocolVersion).encode(byteBuf, this);
|
optionalManager.get().getPacketAdapter(protocolVersion).encode(byteBuf, this, protocolVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,7 +196,7 @@ public final class TabPlayer implements Comparable<TabPlayer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a nametag to be displayed above a player, with prefix & suffix
|
* Represents a nametag to be displayed above a player, with prefix and suffix
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
Loading…
Reference in New Issue
Block a user