From c23fdd1ff65f9459af73d6eca9e00ce570fb50bb Mon Sep 17 00:00:00 2001 From: William Date: Tue, 23 Apr 2024 16:23:36 +0100 Subject: [PATCH] feat: Add support for Minecraft 1.20.5 (#186) * feat: support Minecraft 1.20.5 * build: bump to 1.6.5 * refactor: optimize imports * docs: update about menu author credits * docs: update velocity meta author credits * docs: update URL * refactor: use Minedown from new repo * docs: shorten name of Plugin Message API docs page * deps: bump minimum Velocity version to 380 --- build.gradle | 2 +- docs/API.md | 3 ++- docs/Formatting.md | 2 +- docs/Home.md | 2 +- ...ugin-Message-API-Examples.md => Plugin-Message-API.md} | 0 docs/_Sidebar.md | 2 +- gradle.properties | 4 ++-- .../net/william278/velocitab/api/PluginMessageAPI.java | 5 ++++- .../william278/velocitab/commands/VelocitabCommand.java | 7 +++---- .../java/net/william278/velocitab/config/Formatter.java | 2 +- .../william278/velocitab/packet/Protocol765Adapter.java | 3 ++- .../william278/velocitab/packet/ScoreboardManager.java | 8 ++++++-- .../java/net/william278/velocitab/tab/VanishTabList.java | 2 -- src/main/resources/velocity-plugin.json | 5 +++-- 14 files changed, 27 insertions(+), 20 deletions(-) rename docs/{Plugin-Message-API-Examples.md => Plugin-Message-API.md} (100%) diff --git a/build.gradle b/build.gradle index 875c526..a59f24a 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,7 @@ dependencies { implementation 'org.apache.commons:commons-text:1.12.0' implementation 'net.william278:DesertWell:2.0.4' - implementation 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT' + implementation 'net.william278:minedown:1.8.2' implementation 'org.bstats:bstats-velocity:3.0.2' implementation 'de.exlll:configlib-yaml:4.5.0' diff --git a/docs/API.md b/docs/API.md index 613c417..9541010 100644 --- a/docs/API.md +++ b/docs/API.md @@ -154,4 +154,5 @@ public class VelocitabAPIHook { ### 6. Next steps Now that you've got everything ready, you can start doing stuff with the Velocitab API! -- [[API Examples]] \ No newline at end of file +- [[API Examples]] +- See also: [[Plugin Message API]] \ No newline at end of file diff --git a/docs/Formatting.md b/docs/Formatting.md index 127aae8..6b50d3c 100644 --- a/docs/Formatting.md +++ b/docs/Formatting.md @@ -3,7 +3,7 @@ Velocitab supports the full range of modern color formatting, including RGB colo Formatting is applied on header, footer and player text for each server group, and is applied after [[Placeholders]] have been inserted. ## MineDown syntax reference -MineDown is the default formatter type, enabled by setting `formatter` to `MINEDOWN` in `config.yml`. See the [MineDown Syntax Reference](https://github.com/Phoenix616/MineDown) on GitHub for the specification of how to format text with it. +MineDown is the default formatter type, enabled by setting `formatter` to `MINEDOWN` in `config.yml`. See the [MineDown Syntax Reference](https://github.com/WiIIiam278/MineDown) on GitHub for the specification of how to format text with it. ## MiniMessage syntax reference MiniMessage formatting can be enabled by setting `formatter` to `MINIMESSAGE` in `config.yml`. See the [MiniMessage Syntax Reference](https://docs.advntr.dev/minimessage/format.html) on the Adventure Docs for how to format text with it. Using MiniMessage as the formatter also allows compatibility for using MiniPlaceholders in text. diff --git a/docs/Home.md b/docs/Home.md index 4141830..83fa545 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -18,7 +18,7 @@ Please click through to the topic you wish to read about. * 🖼️ [[Custom Logos]] * 📦 [[API]] * 📝 [[API Examples]] - * 📝 [[Plugin Message API Examples]] + * 📝 [[Plugin Message API]] ## Links * 💻 [GitHub](https://github.com/WiIIiam278/Velocitab) diff --git a/docs/Plugin-Message-API-Examples.md b/docs/Plugin-Message-API.md similarity index 100% rename from docs/Plugin-Message-API-Examples.md rename to docs/Plugin-Message-API.md diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index 726ab5d..8e2be8e 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -12,7 +12,7 @@ * 🖼️ [[Custom Logos]] * 📦 [[API]] * 📝 [[API Examples]] - * 📝 [[Plugin Message API Examples]] + * 📝 [[Plugin Message API]] ## Links * 💻 [GitHub](https://github.com/WiIIiam278/Velocitab) diff --git a/gradle.properties b/gradle.properties index 176ce93..b09d45f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ javaVersion=17 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.daemon=true -plugin_version=1.6.4 +plugin_version=1.6.5 plugin_archive=velocitab plugin_description=A beautiful and versatile TAB list plugin for Velocity proxies velocity_api_version=3.3.0 -velocity_minimum_build=329 \ No newline at end of file +velocity_minimum_build=380 \ No newline at end of file diff --git a/src/main/java/net/william278/velocitab/api/PluginMessageAPI.java b/src/main/java/net/william278/velocitab/api/PluginMessageAPI.java index 8ea3f98..4c32fed 100644 --- a/src/main/java/net/william278/velocitab/api/PluginMessageAPI.java +++ b/src/main/java/net/william278/velocitab/api/PluginMessageAPI.java @@ -29,7 +29,10 @@ import net.william278.velocitab.packet.UpdateTeamsPacket; import net.william278.velocitab.player.TabPlayer; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Arrays; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; public class PluginMessageAPI { diff --git a/src/main/java/net/william278/velocitab/commands/VelocitabCommand.java b/src/main/java/net/william278/velocitab/commands/VelocitabCommand.java index e6fc16a..5a0e288 100644 --- a/src/main/java/net/william278/velocitab/commands/VelocitabCommand.java +++ b/src/main/java/net/william278/velocitab/commands/VelocitabCommand.java @@ -21,7 +21,6 @@ package net.william278.velocitab.commands; import com.mojang.brigadier.Command; import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.RequiredArgumentBuilder; import com.velocitypowered.api.command.BrigadierCommand; @@ -47,10 +46,10 @@ public final class VelocitabCommand { .title(Component.text("Velocitab")) .description(Component.text(plugin.getDescription().getDescription().orElseThrow())) .version(plugin.getVersion()) - .credits("Author", - AboutMenu.Credit.of("William278").description("Click to visit website").url("https://william278.net")) + .credits("Authors", + AboutMenu.Credit.of("William278").description("Click to visit website").url("https://william278.net"), + AboutMenu.Credit.of("AlexDev03").description("Click to visit GitHub").url("https://github.com/alexdev03")) .credits("Contributors", - AboutMenu.Credit.of("AlexDev03").description("Code"), AboutMenu.Credit.of("Ironboundred").description("Code"), AboutMenu.Credit.of("Emibergo02").description("Code"), AboutMenu.Credit.of("FreeMonoid").description("Code"), diff --git a/src/main/java/net/william278/velocitab/config/Formatter.java b/src/main/java/net/william278/velocitab/config/Formatter.java index 0e8b44c..dbf5536 100644 --- a/src/main/java/net/william278/velocitab/config/Formatter.java +++ b/src/main/java/net/william278/velocitab/config/Formatter.java @@ -37,7 +37,7 @@ import java.util.function.Function; public enum Formatter { MINEDOWN( (text, player, plugin) -> new MineDown(text).toComponent(), - (text) -> text.replace("__", "_\\_"), + MineDown::escape, "MineDown", (text) -> new MineDown(text).toComponent() ), diff --git a/src/main/java/net/william278/velocitab/packet/Protocol765Adapter.java b/src/main/java/net/william278/velocitab/packet/Protocol765Adapter.java index c547db8..28a0d10 100644 --- a/src/main/java/net/william278/velocitab/packet/Protocol765Adapter.java +++ b/src/main/java/net/william278/velocitab/packet/Protocol765Adapter.java @@ -38,7 +38,8 @@ public class Protocol765Adapter extends Protocol404Adapter { public Protocol765Adapter(@NotNull Velocitab plugin) { super(plugin, Set.of( - ProtocolVersion.MINECRAFT_1_20_3 + ProtocolVersion.MINECRAFT_1_20_3, + ProtocolVersion.MINECRAFT_1_20_5 )); } diff --git a/src/main/java/net/william278/velocitab/packet/ScoreboardManager.java b/src/main/java/net/william278/velocitab/packet/ScoreboardManager.java index f247e59..bdebdc8 100644 --- a/src/main/java/net/william278/velocitab/packet/ScoreboardManager.java +++ b/src/main/java/net/william278/velocitab/packet/ScoreboardManager.java @@ -35,7 +35,10 @@ import net.william278.velocitab.tab.Nametag; import org.jetbrains.annotations.NotNull; import org.slf4j.event.Level; -import java.util.*; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import static com.velocitypowered.api.network.ProtocolVersion.*; @@ -281,7 +284,8 @@ public class ScoreboardManager { .mapping(0x56, MINECRAFT_1_19_3, true) .mapping(0x5A, MINECRAFT_1_19_4, true) .mapping(0x5C, MINECRAFT_1_20_2, true) - .mapping(0x5E, MINECRAFT_1_20_3, true); + .mapping(0x5E, MINECRAFT_1_20_3, true) + .mapping(0x60, MINECRAFT_1_20_5, true); packetRegistration.register(); } catch (Throwable e) { plugin.log(Level.ERROR, "Failed to register UpdateTeamsPacket", e); diff --git a/src/main/java/net/william278/velocitab/tab/VanishTabList.java b/src/main/java/net/william278/velocitab/tab/VanishTabList.java index 5bf3c4b..89907bd 100644 --- a/src/main/java/net/william278/velocitab/tab/VanishTabList.java +++ b/src/main/java/net/william278/velocitab/tab/VanishTabList.java @@ -25,9 +25,7 @@ import net.william278.velocitab.player.TabPlayer; import org.jetbrains.annotations.NotNull; import java.util.Optional; -import java.util.Set; import java.util.UUID; -import java.util.stream.Collectors; /** * The VanishTabList handles the tab list for vanished players diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index d487004..f39535e 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -3,9 +3,10 @@ "name": "Velocitab", "version": "${version}", "description": "${description}", - "url": "https://william278.net", + "url": "https://william278.net/project/velocitab", "authors": [ - "William278" + "William278", + "AlexDev03" ], "dependencies": [ {