From 50bc80960e79587bc0fcf70d37625767048c41d4 Mon Sep 17 00:00:00 2001 From: Old Chum <57156982+Old-Chum@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:03:42 -0700 Subject: [PATCH] Allows hovering over auto ignored peoples names to see what they said --- .../impl/module/misc/AutoIgnoreModule.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java index a26c5f0..8a4748c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java @@ -10,7 +10,10 @@ import me.rigamortis.seppuku.api.value.Value; import net.minecraft.client.Minecraft; import net.minecraft.network.play.server.SPacketChat; import net.minecraft.util.StringUtils; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.event.HoverEvent; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import java.util.ArrayList; @@ -77,15 +80,36 @@ public final class AutoIgnoreModule extends Module { switch (this.mode.getValue()) { case CLIENT: Seppuku.INSTANCE.getIgnoredManager().add(username); - Seppuku.INSTANCE.logChat("Added \247c" + username + "\247f to your ignore list"); + + ITextComponent ignoreMessage = (new TextComponentString("Added ")).appendSibling( + new TextComponentString("\247c" + username) + .setStyle(new Style() + .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, packet.chatComponent))) + ).appendSibling(new TextComponentString("\247f to your ignore list")); + + Seppuku.INSTANCE.logcChat(ignoreMessage); break; case SERVER: Seppuku.INSTANCE.getChatManager().add("/ignore " + username); + + ignoreMessage = (new TextComponentString("Ignored ")).appendSibling( + new TextComponentString("\247c" + username) + .setStyle(new Style() + .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, packet.chatComponent)))); + + Seppuku.INSTANCE.logcChat(ignoreMessage); break; case BOTH: Seppuku.INSTANCE.getChatManager().add("/ignore " + username); Seppuku.INSTANCE.getIgnoredManager().add(username); - Seppuku.INSTANCE.logChat("Added \247c" + username + "\247f to your ignore list"); + + ignoreMessage = (new TextComponentString("Added ")).appendSibling( + new TextComponentString("\247c" + username) + .setStyle(new Style() + .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, packet.chatComponent))) + ).appendSibling(new TextComponentString("\247f to your ignore list")); + + Seppuku.INSTANCE.logcChat(ignoreMessage); break; } }