From 22a8fe115c98fcf98d5d70e099acb81d9c3375a6 Mon Sep 17 00:00:00 2001 From: AlexDerProGamer <111710468+AlexDerProGamer@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:30:47 +0100 Subject: [PATCH] Updated to 1.21.3 --- buildSrc/src/main/kotlin/Properties.kt | 21 +++++++++++-------- .../voicechatdiscord/FabricPlatform.java | 20 +++++++++--------- .../voicechatdiscord/PaperPlatform.java | 4 +++- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/buildSrc/src/main/kotlin/Properties.kt b/buildSrc/src/main/kotlin/Properties.kt index d29c1a3..c498487 100644 --- a/buildSrc/src/main/kotlin/Properties.kt +++ b/buildSrc/src/main/kotlin/Properties.kt @@ -10,19 +10,19 @@ object Properties { /* Paper */ const val paperApiVersion = "1.19" - const val paperMinecraftDevVersion = "1.21" - const val paperDevBundleVersion = "1.21-R0.1-SNAPSHOT" + const val paperMinecraftDevVersion = "1.21.3" + const val paperDevBundleVersion = "1.21.3-R0.1-SNAPSHOT" /* Fabric (https://fabricmc.net/develop) */ const val fabricLoaderRequiredVersion = "0.14.22" - const val fabricMinecraftDevVersion = "1.21" - const val yarnMappingsDevVersion = "$fabricMinecraftDevVersion+build.7" - const val fabricLoaderDevVersion = "0.15.11" - const val fabricApiDevVersion = "0.100.4+$fabricMinecraftDevVersion" + const val fabricMinecraftDevVersion = "1.21.3" + const val yarnMappingsDevVersion = "$fabricMinecraftDevVersion+build.2" + const val fabricLoaderDevVersion = "0.16.9" + const val fabricApiDevVersion = "0.107.3+$fabricMinecraftDevVersion" /* Dependencies */ - const val voicechatApiVersion = "2.4.11" - const val voicechatModRuntimeVersion = "2.5.16" + const val voicechatApiVersion = "2.5.0" + const val voicechatModRuntimeVersion = "2.5.25" const val yamlConfigurationVersion = "2.0.2" const val javaSemverVersion = "0.10.2" const val gsonVersion = "2.10.1" @@ -42,7 +42,10 @@ object Properties { "1.20.4", "1.20.5", "1.20.6", - "1.21" + "1.21", + "1.21.1", + "1.21.2", + "1.21.3" ) /* Gradle Plugins */ diff --git a/fabric/src/main/java/dev/amsam0/voicechatdiscord/FabricPlatform.java b/fabric/src/main/java/dev/amsam0/voicechatdiscord/FabricPlatform.java index 2097e4f..c4e5fca 100644 --- a/fabric/src/main/java/dev/amsam0/voicechatdiscord/FabricPlatform.java +++ b/fabric/src/main/java/dev/amsam0/voicechatdiscord/FabricPlatform.java @@ -75,7 +75,7 @@ else if (sender instanceof CommandContext context) { } public void sendMessage(Player player, String message) { - ((PlayerEntity) player.getPlayer()).sendMessage(toNative(mm(message))); + ((PlayerEntity) player.getPlayer()).sendMessage(toNative(mm(message)), false); } public String getName(Player player) { @@ -149,7 +149,7 @@ private Text toNative(Component component) { var color = component.color(); if (color != null) - style = style.withColor(TextColor.fromRgb(Integer.parseInt(color.asHexString().substring(1), 16))); + style = style.withColor(net.minecraft.text.TextColor.fromRgb(Integer.parseInt(color.asHexString().substring(1), 16))); for (var entry : component.decorations().entrySet()) { var decoration = entry.getKey(); @@ -170,17 +170,17 @@ private Text toNative(Component component) { var clickEvent = component.clickEvent(); if (clickEvent != null) { - ClickEvent.Action action = null; + net.minecraft.text.ClickEvent.Action action = null; switch (clickEvent.action()) { - case OPEN_URL -> action = ClickEvent.Action.OPEN_URL; - case OPEN_FILE -> action = ClickEvent.Action.OPEN_FILE; - case RUN_COMMAND -> action = ClickEvent.Action.RUN_COMMAND; - case SUGGEST_COMMAND -> action = ClickEvent.Action.SUGGEST_COMMAND; - case CHANGE_PAGE -> action = ClickEvent.Action.CHANGE_PAGE; - case COPY_TO_CLIPBOARD -> action = ClickEvent.Action.COPY_TO_CLIPBOARD; + case OPEN_URL -> action = net.minecraft.text.ClickEvent.Action.OPEN_URL; + case OPEN_FILE -> action = net.minecraft.text.ClickEvent.Action.OPEN_FILE; + case RUN_COMMAND -> action = net.minecraft.text.ClickEvent.Action.RUN_COMMAND; + case SUGGEST_COMMAND -> action = net.minecraft.text.ClickEvent.Action.SUGGEST_COMMAND; + case CHANGE_PAGE -> action = net.minecraft.text.ClickEvent.Action.CHANGE_PAGE; + case COPY_TO_CLIPBOARD -> action = net.minecraft.text.ClickEvent.Action.COPY_TO_CLIPBOARD; default -> warn("Unknown click event action: " + clickEvent.action()); } - style = style.withClickEvent(new ClickEvent(action, clickEvent.value())); + style = style.withClickEvent(new net.minecraft.text.ClickEvent(action, clickEvent.value())); } var hoverEvent = component.hoverEvent(); diff --git a/paper/src/main/java/dev/amsam0/voicechatdiscord/PaperPlatform.java b/paper/src/main/java/dev/amsam0/voicechatdiscord/PaperPlatform.java index cb70ecf..df0a5b1 100644 --- a/paper/src/main/java/dev/amsam0/voicechatdiscord/PaperPlatform.java +++ b/paper/src/main/java/dev/amsam0/voicechatdiscord/PaperPlatform.java @@ -4,6 +4,7 @@ import de.maxhenkel.voicechat.api.Position; import de.maxhenkel.voicechat.api.ServerLevel; import de.maxhenkel.voicechat.api.ServerPlayer; +import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; @@ -56,7 +57,8 @@ public ServerPlayer commandContextToPlayer(CommandContext context) { } } if (nmsEntity == null) return null; - @SuppressWarnings("DataFlowIssue") Entity entity = (Entity) nmsEntity.getBukkitSender(null); + Entity entity = Bukkit.getEntity(nmsEntity.getUUID()); + if (entity == null) return null; return api.createPosition( entity.getLocation().getX(), entity.getLocation().getY(),