fix chat history with chatappend
This commit is contained in:
parent
1cafa1dd38
commit
b5a34bd2f6
2 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ import com.baseband.client.feature.category.Chat;
|
|||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
|
@ -41,7 +42,9 @@ public class ChatAppend extends Feature {
|
|||
if(message.matches("\\W.*"))
|
||||
return;
|
||||
|
||||
event.setMessage(applyWatermark((custom ? (customUnicodeToggle ? toUnicode(customWatermark) : customWatermark) : toUnicode("baseband")), message));
|
||||
ChatUtil.history(message);
|
||||
ChatUtil.send(applyWatermark((custom ? (customUnicodeToggle ? toUnicode(customWatermark) : customWatermark) : toUnicode("baseband")), message), false);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
private String applyWatermark(String watermark, String text) {
|
||||
|
|
|
@ -51,6 +51,9 @@ public class ChatUtil {
|
|||
|
||||
public static void simulateSend(String msg, boolean addToHistory) {
|
||||
msg = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(msg);
|
||||
send(msg, addToHistory);
|
||||
}
|
||||
public static void send(String msg, boolean addToHistory) {
|
||||
if (msg.isEmpty()) return;
|
||||
if (addToHistory) {
|
||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().addToSentMessages(msg);
|
||||
|
|
Loading…
Add table
Reference in a new issue