@@ -11,6 +11,7 @@ use crate::command::args::{ConsumedArgs, FindArg};
1111use crate :: command:: tree:: CommandTree ;
1212use crate :: command:: tree:: builder:: { argument, literal} ;
1313use crate :: command:: { CommandError , CommandExecutor , CommandSender } ;
14+ use crate :: entity:: EntityBase ;
1415use crate :: entity:: player:: Player ;
1516
1617const NAMES : [ & str ; 2 ] = [ "experience" , "xp" ] ;
@@ -52,7 +53,7 @@ impl Executor {
5253 . send_message ( TextComponent :: translate (
5354 "commands.experience.query.levels" ,
5455 [
55- TextComponent :: text ( target. gameprofile . name . clone ( ) ) ,
56+ target. get_display_name ( ) . await ,
5657 TextComponent :: text ( level. to_string ( ) ) ,
5758 ] ,
5859 ) )
@@ -64,7 +65,7 @@ impl Executor {
6465 . send_message ( TextComponent :: translate (
6566 "commands.experience.query.points" ,
6667 [
67- TextComponent :: text ( target. gameprofile . name . clone ( ) ) ,
68+ target. get_display_name ( ) . await ,
6869 TextComponent :: text ( points. to_string ( ) ) ,
6970 ] ,
7071 ) )
@@ -78,7 +79,7 @@ impl Executor {
7879 exp_type : ExpType ,
7980 amount : i32 ,
8081 targets_len : usize ,
81- target_name : Option < String > ,
82+ target_name : Option < TextComponent > ,
8283 ) -> TextComponent {
8384 match ( mode, exp_type) {
8485 ( Mode :: Add , ExpType :: Points ) => {
@@ -95,7 +96,7 @@ impl Executor {
9596 "commands.experience.add.points.success.single" ,
9697 [
9798 TextComponent :: text ( amount. to_string ( ) ) ,
98- TextComponent :: text ( target_name. unwrap ( ) ) ,
99+ target_name. unwrap ( ) ,
99100 ] ,
100101 )
101102 }
@@ -114,7 +115,7 @@ impl Executor {
114115 "commands.experience.add.levels.success.single" ,
115116 [
116117 TextComponent :: text ( amount. to_string ( ) ) ,
117- TextComponent :: text ( target_name. unwrap ( ) ) ,
118+ target_name. unwrap ( ) ,
118119 ] ,
119120 )
120121 }
@@ -133,7 +134,7 @@ impl Executor {
133134 "commands.experience.set.points.success.single" ,
134135 [
135136 TextComponent :: text ( amount. to_string ( ) ) ,
136- TextComponent :: text ( target_name. unwrap ( ) ) ,
137+ target_name. unwrap ( ) ,
137138 ] ,
138139 )
139140 }
@@ -152,7 +153,7 @@ impl Executor {
152153 "commands.experience.set.levels.success.single" ,
153154 [
154155 TextComponent :: text ( amount. to_string ( ) ) ,
155- TextComponent :: text ( target_name. unwrap ( ) ) ,
156+ target_name. unwrap ( ) ,
156157 ] ,
157158 )
158159 }
@@ -247,7 +248,7 @@ impl CommandExecutor for Executor {
247248 self . exp_type . unwrap ( ) ,
248249 amount,
249250 targets. len ( ) ,
250- Some ( target. gameprofile . name . clone ( ) ) ,
251+ Some ( target. get_display_name ( ) . await ) ,
251252 ) ;
252253 sender. send_message ( msg) . await ;
253254 }
0 commit comments