From 651624a71d2b293bb4b89b31e50998fe1f43e63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Gra=C3=A7a?= Date: Fri, 10 Apr 2026 14:54:13 +0100 Subject: [PATCH 1/2] Integrate vanish mod support and update dependencies --- build.gradle.kts | 5 +++++ .../modules/hat/commands/HatCommand.java | 2 +- .../modules/tablist/TabListModule.java | 20 ++++++++++--------- .../modules/tell/commands/TellCommand.java | 17 +++++++++++++++- versions/1.20.1/gradle.properties | 1 + versions/1.21.1/gradle.properties | 1 + versions/1.21.11/gradle.properties | 1 + versions/1.21.4/gradle.properties | 1 + 8 files changed, 37 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e72f63c7..3f8b6fde 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,6 +25,10 @@ repositories { name = "Ladysnake Libs" url = uri("https://maven.ladysnake.org/releases") } + maven { + name = "Modrinth" + url = uri("https://api.modrinth.com/maven") + } } val accessWidener = rootProject.file("src/main/resources/solstice.accesswidener") loom { @@ -50,6 +54,7 @@ dependencies { modCompileOnly("dev.emi:trinkets:${property("trinkets_version")}") modCompileOnly("net.luckperms:api:5.4") modRuntimeOnly("net.luckperms:api:5.4") + modCompileOnly("maven.modrinth:vanish:${project.property("vanish_version")}") } tasks.processResources { val mcConstraint = project.property("minecraft_constraint") as String diff --git a/src/main/java/me/alexdevs/solstice/modules/hat/commands/HatCommand.java b/src/main/java/me/alexdevs/solstice/modules/hat/commands/HatCommand.java index bc0cd74f..9b718daa 100644 --- a/src/main/java/me/alexdevs/solstice/modules/hat/commands/HatCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/hat/commands/HatCommand.java @@ -59,7 +59,7 @@ public LiteralArgumentBuilder command(String name) { //? if < 1.21.11 { var oldHeadStack = inventory.armor.get(3); // head slot - //inventory.setItem(inventory.selected, oldHeadStack.copyAndClear()); + inventory.setItem(inventory.selected, oldHeadStack.copyAndClear()); //? } else { /*var oldHeadStack = player.getItemBySlot(EquipmentSlot.HEAD); inventory.setItem(inventory.getSelectedSlot(), oldHeadStack.copyAndClear()); diff --git a/src/main/java/me/alexdevs/solstice/modules/tablist/TabListModule.java b/src/main/java/me/alexdevs/solstice/modules/tablist/TabListModule.java index 3e380d02..7770c319 100644 --- a/src/main/java/me/alexdevs/solstice/modules/tablist/TabListModule.java +++ b/src/main/java/me/alexdevs/solstice/modules/tablist/TabListModule.java @@ -72,15 +72,17 @@ public void updateTab() { "phase", String.valueOf(phase) ); - server.getPlayerList().getPlayers().forEach(player -> { - var playerContext = PlaceholderContext.of(player); - var header = RawPlaceholder.parse(String.join("\n", config.header), placeholders); - var footer = RawPlaceholder.parse(String.join("\n", config.footer), placeholders); - player.connection.send(new ClientboundTabListPacket( - Format.parse(header, playerContext), - Format.parse(footer, playerContext) - )); - }); + server.execute(() -> + server.getPlayerList().getPlayers().forEach(player -> { + var playerContext = PlaceholderContext.of(player); + var header = RawPlaceholder.parse(String.join("\n", config.header), placeholders); + var footer = RawPlaceholder.parse(String.join("\n", config.footer), placeholders); + player.connection.send(new ClientboundTabListPacket( + Format.parse(header, playerContext), + Format.parse(footer, playerContext) + )); + }) + ); } /*public List getGroupsOrder() { diff --git a/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java b/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java index c06d29cf..23bc499a 100644 --- a/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java @@ -7,6 +7,8 @@ import me.alexdevs.solstice.api.module.ModCommand; import me.alexdevs.solstice.api.module.Utils; import me.alexdevs.solstice.modules.tell.TellModule; +import me.drex.vanish.api.VanishAPI; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -41,8 +43,21 @@ public LiteralArgumentBuilder command(String name) { .then(argument("player", StringArgumentType.word()) .suggests((context, builder) -> { var playerManager = context.getSource().getServer().getPlayerList(); + final String[] playerNamesArray; + + final boolean hasVanish = FabricLoader.getInstance().isModLoaded("melius-vanish"); + + if (hasVanish) { + playerNamesArray = VanishAPI.getVisiblePlayers(context.getSource()).stream() + .map(player -> player.getName().getString()) + .toList().toArray(String[]::new); + } + else { + playerNamesArray = playerManager.getPlayerNamesArray(); + } + return SharedSuggestionProvider.suggest( - playerManager.getPlayerNamesArray(), + playerNamesArray, builder); }) .then(argument("message", StringArgumentType.greedyString()) diff --git a/versions/1.20.1/gradle.properties b/versions/1.20.1/gradle.properties index cc3ffa15..15c3f898 100644 --- a/versions/1.20.1/gradle.properties +++ b/versions/1.20.1/gradle.properties @@ -13,3 +13,4 @@ sgui_version=1.2.2+1.20 commoneconomy_version=1.1.1 trinkets_version=3.7.2 +vanish_version=1.5.5+1.20.1 \ No newline at end of file diff --git a/versions/1.21.1/gradle.properties b/versions/1.21.1/gradle.properties index fe8580da..1841297c 100644 --- a/versions/1.21.1/gradle.properties +++ b/versions/1.21.1/gradle.properties @@ -14,3 +14,4 @@ sgui_version=1.6.1+1.21.1 commoneconomy_version=1.1.1 trinkets_version=3.10.0 +vanish_version=1.6.6+1.21.1 \ No newline at end of file diff --git a/versions/1.21.11/gradle.properties b/versions/1.21.11/gradle.properties index 6cd28eca..9dacca63 100644 --- a/versions/1.21.11/gradle.properties +++ b/versions/1.21.11/gradle.properties @@ -14,3 +14,4 @@ sgui_version=1.12.0+1.21.11 commoneconomy_version=2.0.0 trinkets_version=3.10.0 +vanish_version=1.6.6+1.21.11 \ No newline at end of file diff --git a/versions/1.21.4/gradle.properties b/versions/1.21.4/gradle.properties index 353bb674..4420bdd8 100644 --- a/versions/1.21.4/gradle.properties +++ b/versions/1.21.4/gradle.properties @@ -14,3 +14,4 @@ sgui_version=1.8.2+1.21.4 commoneconomy_version=1.2.0 trinkets_version=3.10.0 +vanish_version=1.6.6+1.21.4 \ No newline at end of file From 9623f2bca08bd7050dc8bcc7e0306f7c7f72def7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Gra=C3=A7a?= Date: Tue, 9 Jun 2026 17:30:26 +0100 Subject: [PATCH 2/2] Move Vanish logic to VanishIntegration --- .../integrations/VanishIntegration.java | 24 +++++++++++++++++++ .../modules/tell/commands/TellCommand.java | 9 +++---- 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 src/main/java/me/alexdevs/solstice/integrations/VanishIntegration.java diff --git a/src/main/java/me/alexdevs/solstice/integrations/VanishIntegration.java b/src/main/java/me/alexdevs/solstice/integrations/VanishIntegration.java new file mode 100644 index 00000000..54635c1e --- /dev/null +++ b/src/main/java/me/alexdevs/solstice/integrations/VanishIntegration.java @@ -0,0 +1,24 @@ +package me.alexdevs.solstice.integrations; + +import me.drex.vanish.api.VanishAPI; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerPlayer; + +import java.util.List; + +public class VanishIntegration { + public static boolean isAvailable() { + return FabricLoader.getInstance().isModLoaded("melius-vanish"); + } + + public static List getVisiblePlayers(CommandSourceStack source) { + return VanishAPI.getVisiblePlayers(source); + } + + public static String[] getVisiblePlayersAsString(CommandSourceStack source) { + return getVisiblePlayers(source).stream() + .map(player -> player.getName().getString()) + .toList().toArray(String[]::new); + } +} diff --git a/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java b/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java index 23bc499a..45a0a5cc 100644 --- a/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/tell/commands/TellCommand.java @@ -6,6 +6,7 @@ import com.mojang.brigadier.context.CommandContext; import me.alexdevs.solstice.api.module.ModCommand; import me.alexdevs.solstice.api.module.Utils; +import me.alexdevs.solstice.integrations.VanishIntegration; import me.alexdevs.solstice.modules.tell.TellModule; import me.drex.vanish.api.VanishAPI; import net.fabricmc.loader.api.FabricLoader; @@ -45,12 +46,8 @@ public LiteralArgumentBuilder command(String name) { var playerManager = context.getSource().getServer().getPlayerList(); final String[] playerNamesArray; - final boolean hasVanish = FabricLoader.getInstance().isModLoaded("melius-vanish"); - - if (hasVanish) { - playerNamesArray = VanishAPI.getVisiblePlayers(context.getSource()).stream() - .map(player -> player.getName().getString()) - .toList().toArray(String[]::new); + if (VanishIntegration.isAvailable()) { + playerNamesArray = VanishIntegration.getVisiblePlayersAsString(context.getSource()); } else { playerNamesArray = playerManager.getPlayerNamesArray();