Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlimiter committed Sep 6, 2022
1 parent 24c3158 commit 0c60204
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package cn.evolvefield.mods.botapi.init.handler;

import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;

import java.util.LinkedList;
import java.util.Queue;
import java.util.UUID;

/**
* Description:
Expand All @@ -28,7 +26,7 @@ public static void init() {
String toSend = toSendQueue.poll();
if (!world.isClientSide && toSend != null) {
Component textComponents = Component.literal(toSend);
world.getServer().getPlayerList().broadcastSystemMessage(textComponents, ChatType.CHAT);
world.getServer().getPlayerList().broadcastSystemMessage(textComponents, true);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ public double averageMspt() {
public @NotNull TickTimes tickTimes60s() {
return this.tickTimes60s;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.FilteredText;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -24,9 +23,9 @@ public class ServerGamePacketListenerImplMixin {
@Shadow
public ServerPlayer player;

@Inject(method = "broadcastChatMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/players/PlayerList;broadcastChatMessage(Lnet/minecraft/server/network/FilteredText;Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/resources/ResourceKey;)V"))
public void SGPLI_handleChat(FilteredText<PlayerChatMessage> filteredText, CallbackInfo ci) {
String s1 = filteredText.raw().serverContent().getString();
@Inject(method = "broadcastChatMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/players/PlayerList;broadcastChatMessage(Lnet/minecraft/network/chat/PlayerChatMessage;Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/network/chat/ChatType$Bound;)V"))
public void SGPLI_handleChat(PlayerChatMessage filteredText, CallbackInfo ci) {
String s1 = filteredText.serverContent().getString();
Component component2 = Component.translatable("chat.type.text", this.player.getDisplayName(), s1);
ServerLevelEvents.Server_Chat.invoker().onChat(this.player, s1, component2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"botapi.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.9",
"fabricloader": "*",
"fabric": "*",
"minecraft": "1.19.2"
}
Expand Down

0 comments on commit 0c60204

Please sign in to comment.