diff --git a/fabric/build.gradle b/fabric/build.gradle index 69862ef..e6a3fe0 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -73,7 +73,7 @@ loom { dependencies { // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" + minecraft "com.mojang:minecraft:${project.minecraft_version_fabric}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" diff --git a/src/fabric/main/java/com/ampznetwork/banmod/fabric/BanModFabric.java b/src/fabric/main/java/com/ampznetwork/banmod/fabric/BanModFabric.java index 0ef9505..e304247 100644 --- a/src/fabric/main/java/com/ampznetwork/banmod/fabric/BanModFabric.java +++ b/src/fabric/main/java/com/ampznetwork/banmod/fabric/BanModFabric.java @@ -18,7 +18,6 @@ import net.kyori.adventure.util.TriState; import net.minecraft.server.MinecraftServer; import net.minecraft.text.Text; -import net.minecraft.text.TextCodecs; import org.comroid.api.func.util.Command; import org.comroid.api.java.StackTraceUtils; import org.comroid.api.tree.LifeCycle; @@ -35,11 +34,6 @@ public class BanModFabric extends SubMod$Fabric implements BanMod, ModInitialize StackTraceUtils.EXTRA_FILTER_NAMES.add("com.ampznetwork"); } - public static Text component2text(net.kyori.adventure.text.Component component) { - var json = GsonComponentSerializer.gson().serializeToTree(component); - return TextCodecs.STRINGIFIED_CODEC.parse(JsonOps.INSTANCE, json).getOrThrow(JsonParseException::new); - } - private final FabricEventDispatch eventDispatch = new FabricEventDispatch(this); private BanModConfig config = Config.createAndLoad(BanModConfig.class); private MinecraftServer server; diff --git a/src/fabric/main/java/com/ampznetwork/banmod/fabric/adp/internal/FabricEventDispatch.java b/src/fabric/main/java/com/ampznetwork/banmod/fabric/adp/internal/FabricEventDispatch.java index 0370ef1..7277392 100644 --- a/src/fabric/main/java/com/ampznetwork/banmod/fabric/adp/internal/FabricEventDispatch.java +++ b/src/fabric/main/java/com/ampznetwork/banmod/fabric/adp/internal/FabricEventDispatch.java @@ -7,7 +7,7 @@ import com.ampznetwork.libmod.fabric.LibModFabric; import lombok.Value; import net.fabricmc.fabric.api.message.v1.ServerMessageEvents; -import net.fabricmc.fabric.api.networking.v1.LoginPacketSender; +import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.ServerLoginConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerLoginNetworking; import net.minecraft.network.message.MessageType; @@ -40,7 +40,7 @@ public FabricEventDispatch(BanMod banMod) { @Override public void onLoginStart( - ServerLoginNetworkHandler handler, MinecraftServer server, LoginPacketSender sender, ServerLoginNetworking.LoginSynchronizer synchronizer + ServerLoginNetworkHandler handler, MinecraftServer server, PacketSender sender, ServerLoginNetworking.LoginSynchronizer synchronizer ) { try { // thank you fabric devs for this very useful and reasonable method @@ -79,7 +79,7 @@ public boolean allowChatMessage(SignedMessage message, ServerPlayerEntity sender var maySend = !result.isMuted(); if (!maySend) BanMod.Resources.notify(mod, playerId, Punishment.Mute, result, (id, msg) -> { - var serialize = mod.as(BanModFabric.class).assertion().component2text(msg); + var serialize = LibModFabric.component2text(msg); sender.sendMessage(serialize); }); return maySend;