steel_core/player/
title.rs1use steel_protocol::packets::game::{
4 CClearTitles, CSetActionBarText, CSetSubtitleText, CSetTitleText, CSetTitlesAnimation,
5};
6use text_components::TextComponent;
7
8use crate::player::Player;
9
10impl Player {
11 pub fn send_title(&self, text: impl Into<TextComponent>) {
13 self.send_packet(CSetTitleText::new(text));
14 }
15
16 pub fn send_subtitle(&self, text: impl Into<TextComponent>) {
18 self.send_packet(CSetSubtitleText::new(text));
19 }
20
21 pub fn send_action_bar(&self, text: impl Into<TextComponent>) {
23 self.send_packet(CSetActionBarText::new(text));
24 }
25
26 pub fn send_title_times(&self, fade_in: i32, stay: i32, fade_out: i32) {
28 self.send_packet(CSetTitlesAnimation::new(fade_in, stay, fade_out));
29 }
30
31 pub fn clear_titles(&self) {
33 self.send_packet(CClearTitles::new(false));
34 }
35
36 pub fn reset_titles(&self) {
38 self.send_packet(CClearTitles::new(true));
39 }
40}