diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/TitleData.kt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt new file mode 100644 index 000000000..fe776c8d0 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt @@ -0,0 +1,21 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.TitleReceivedEvent +import net.minecraft.network.play.server.S45PacketTitle +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TitleData { + + @SubscribeEvent + fun onReceiveCurrentShield(event: PacketEvent.ReceiveEvent) { + val packet = event.packet + + if (packet !is S45PacketTitle) return + val message = packet.message ?: return + val formattedText = message.formattedText + if (TitleReceivedEvent(formattedText).postAndCatch()) { + event.isCanceled = true + } + } +}
\ No newline at end of file |