Skip to content

Commit 914a9c0

Browse files
committed
Update to 1.21.6
1 parent 1d9d93d commit 914a9c0

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

blockbot-api/src/main/java/io/github/quiltservertools/blockbotapi/sender/PlayerMessageSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class PlayerMessageSender extends MessageSender {
88
private final ServerPlayerEntity player;
99

1010
public PlayerMessageSender(ServerPlayerEntity player, MessageType type) {
11-
super(player.getName(), player.getDisplayName(), type, player.server.getRegistryManager());
11+
super(player.getName(), player.getDisplayName(), type, player.getServer().getRegistryManager());
1212
this.profile = player.getGameProfile();
1313
this.player = player;
1414
}

libs.versions.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[versions]
2-
minecraft = "1.21.5"
3-
curseforge-minecraft="1.21.5"
4-
fabric-loader = "0.16.13"
5-
yarn-mappings = "1.21.5+build.1"
2+
minecraft = "1.21.6"
3+
curseforge-minecraft="1.21.6"
4+
fabric-loader = "0.16.14"
5+
yarn-mappings = "1.21.6+build.1"
66

7-
fabric-api = "0.120.0+1.21.5"
7+
fabric-api = "0.127.1+1.21.6"
88

99
# Kotlin
1010
fabric-kotlin = "1.13.1+kotlin.2.1.10"
@@ -13,11 +13,11 @@ fabric-kotlin = "1.13.1+kotlin.2.1.10"
1313
kord-extensions = "2.3.1-SNAPSHOT"
1414
mc-discord-reserializer = "4.3.0"
1515
emoji-java = "5.1.1"
16-
adventure-gson = "4.19.0"
16+
adventure-gson = "4.23.0"
1717

18-
placeholder-api = "2.6.2+1.21.5"
19-
permission-api = "0.3.3"
20-
vanish-api = "1.5.11+1.21.4"
18+
placeholder-api = "2.7.0+1.21.6"
19+
permission-api = "0.4.0"
20+
vanish-api = "1.5.18+1.21.6-rc1"
2121
konf = "1.1.2"
2222

2323
[libraries]

src/main/kotlin/io/github/quiltservertools/blockbotdiscord/utility/Extensions.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
package io.github.quiltservertools.blockbotdiscord.utility
22

33
import com.google.common.collect.Iterables
4+
import com.google.gson.Gson
5+
import com.google.gson.GsonBuilder
6+
import com.google.gson.JsonElement
47
import com.mojang.authlib.GameProfile
8+
import com.mojang.serialization.JsonOps
59
import dev.kord.core.entity.Message
610
import me.drex.vanish.api.VanishAPI
711
import net.fabricmc.loader.api.FabricLoader
812
import net.kyori.adventure.text.Component
913
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
10-
import net.minecraft.registry.DynamicRegistryManager
1114
import net.minecraft.registry.RegistryWrapper
1215
import net.minecraft.server.network.ServerPlayerEntity
1316
import net.minecraft.text.MutableText
1417
import net.minecraft.text.Text
18+
import net.minecraft.text.TextCodecs
19+
20+
val GSON: Gson = GsonBuilder().create()
1521

1622
fun String.literal(): MutableText = Text.literal(this)
1723

@@ -25,8 +31,17 @@ fun Message.summary(): String {
2531

2632
fun GameProfile.getTextures() = Iterables.getFirst(this.properties.get("textures"), null)?.value
2733

28-
fun Component.toNative(wrapperLookup: RegistryWrapper.WrapperLookup): MutableText = Text.Serialization.fromJson(GsonComponentSerializer.gson().serialize(this), wrapperLookup)?: Text.empty()
34+
fun Component.toNative(wrapperLookup: RegistryWrapper.WrapperLookup): MutableText {
35+
val json = GSON.fromJson(GsonComponentSerializer.gson().serialize(this), JsonElement::class.java)
36+
return TextCodecs.CODEC.decode(wrapperLookup.getOps(JsonOps.INSTANCE), json)
37+
.result().map { it.first }.orElse(Text.empty()).copy()
38+
}
2939

30-
fun Text.toAdventure(wrapperLookup: RegistryWrapper.WrapperLookup) = GsonComponentSerializer.gson().deserialize(Text.Serialization.toJsonString(this, wrapperLookup))
40+
fun Text.toAdventure(wrapperLookup: RegistryWrapper.WrapperLookup): Component {
41+
return TextCodecs.CODEC.encodeStart(wrapperLookup.getOps(JsonOps.INSTANCE), this).result()
42+
.map { json -> GsonComponentSerializer.gson().deserialize(json.toString()) }
43+
.orElseGet { Component.empty() }
44+
}
3145

32-
fun ServerPlayerEntity.isVanished() = FabricLoader.getInstance().isModLoaded("melius-vanish") && VanishAPI.isVanished(this)
46+
fun ServerPlayerEntity.isVanished() =
47+
FabricLoader.getInstance().isModLoaded("melius-vanish") && VanishAPI.isVanished(this)

0 commit comments

Comments
 (0)