mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Chat works!
This commit is contained in:
1 parent
af3410f874
commit
313ee8715e
2 files changed
+6
-3
No files matched your search
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
@Mixin(PlayerList.class)
|
||||
public interface PlayerListAccessor {
|
||||
|
||||
@Invoker("broadcastChatMessage")
|
||||
void broadcastChatMessage(PlayerChatMessage playerChatMessage, Predicate<ServerPlayer> predicate, ServerPlayer serverPlayer, ChatSender chatSender, ChatType.Bound bound);
|
||||
@Invoker
|
||||
void callBroadcastChatMessage(PlayerChatMessage playerChatMessage, Predicate<ServerPlayer> predicate, ServerPlayer serverPlayer, ChatSender chatSender, ChatType.Bound bound);
|
||||
|
||||
}
|
||||
+4
-1
@@ -53,6 +53,9 @@ abstract class ServerGamePacketListenerImplMixin {
|
||||
|
||||
@Shadow public ServerPlayer player;
|
||||
|
||||
@Shadow
|
||||
protected abstract void detectRateSpam();
|
||||
|
||||
@Redirect(
|
||||
method = "onDisconnect(Lnet/minecraft/network/chat/Component;)V",
|
||||
at = @At(
|
||||
@@ -88,7 +91,7 @@ abstract class ServerGamePacketListenerImplMixin {
|
||||
final ComponentPlayerResult<? extends CarbonPlayer> result = CarbonChatProvider.carbonChat().server().userManager().carbonPlayer(serverPlayer.getUUID()).join();
|
||||
final MessageRecipientFilter filter = new MessageRecipientFilter(serverPlayer, result.player().selectedChannel());
|
||||
|
||||
((PlayerListAccessor) this.server.getPlayerList()).broadcastChatMessage(playerChatMessage, filter::shouldFilterMessageTo, serverPlayer, serverPlayer.asChatSender(), bound);
|
||||
((PlayerListAccessor) this.server.getPlayerList()).callBroadcastChatMessage(playerChatMessage, filter::shouldFilterMessageTo, serverPlayer, serverPlayer.asChatSender(), ChatType.bind(CarbonChatFabric.CHAT_TYPE, serverPlayer.level.registryAccess(), playerChatMessage.serverContent()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user