uh chattimestamp
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 1m59s
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 1m59s
This commit is contained in:
parent
7be74575a7
commit
3b6390c4a4
1 changed files with 21 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
package de.com.baseband.client.feature.modules.chat;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PacketEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
|
@ -12,8 +13,14 @@ import de.com.baseband.client.util.adapt.Marker;
|
|||
import net.minecraft.client.gui.ChatLine;
|
||||
import net.minecraft.client.gui.GuiNewChat;
|
||||
import net.minecraft.network.play.server.SPacketChat;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -44,6 +51,9 @@ public class ChatExtras extends Feature {
|
|||
@Config("InfiniteChat")
|
||||
public boolean infinitechat;
|
||||
|
||||
@Config("ChatTimestamps")
|
||||
public boolean chatTimestamps;
|
||||
|
||||
@Config("DM regex")
|
||||
@Description("ADVANCED!!\nThe RegEx used to distinguish DMs from normal messages.")
|
||||
public String dmRegex = "^((To|From|You whisper to) \\w+|\\w+ whispers( to you)?): .*$";
|
||||
|
@ -65,6 +75,17 @@ public class ChatExtras extends Feature {
|
|||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChat(ClientChatReceivedEvent t) {
|
||||
if (chatTimestamps) {
|
||||
TextComponentString newTextComponentString = new TextComponentString("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "]" + ChatFormatting.RESET + " ");
|
||||
newTextComponentString.setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE));
|
||||
newTextComponentString.appendSibling(t.getMessage());
|
||||
t.setMessage(newTextComponentString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onChat(PacketEvent.Receive event) {
|
||||
if (event.getPacket() instanceof SPacketChat && antiPopLag) {
|
||||
String message = ((SPacketChat) event.getPacket()).getChatComponent().getUnformattedText();
|
||||
|
|
Loading…
Add table
Reference in a new issue