@@ -22,6 +22,12 @@ public DeathMessage(KiriSmpPlugin plugin) {
22
22
this .plugin = plugin ;
23
23
}
24
24
25
+ private static Component coordComponent (char dimension , double value ) {
26
+ Component comp = text ("%s: " .formatted (dimension ), NamedTextColor .GRAY )
27
+ .append (text (Math .round (value ), NamedTextColor .AQUA ));
28
+ return comp ;
29
+ }
30
+
25
31
@ EventHandler
26
32
public void onPlayerDeath (PlayerDeathEvent deathEvent ) {
27
33
Player player = deathEvent .getPlayer ();
@@ -31,21 +37,12 @@ public void onPlayerDeath(PlayerDeathEvent deathEvent) {
31
37
.append (text ("kiriSMP" , NamedTextColor .GREEN , TextDecoration .BOLD ))
32
38
.append (text ("]" , NamedTextColor .DARK_GRAY ));
33
39
34
- Component xComp = text ("X: " , NamedTextColor .GRAY )
35
- .append (text (Math .round (loc .getX ()), NamedTextColor .AQUA ));
36
-
37
- Component yComp = text ("Y: " , NamedTextColor .GRAY )
38
- .append (text (Math .round (loc .getY ()), NamedTextColor .AQUA ));
39
-
40
- Component zComp = text ("Z: " , NamedTextColor .GRAY )
41
- .append (text (Math .round (loc .getZ ()), NamedTextColor .AQUA ));
42
-
43
40
player .sendMessage (
44
41
prefix
45
42
.appendSpace ().append (text (MESSAGE_TEXT , NamedTextColor .WHITE ))
46
- .appendSpace ().append (xComp )
47
- .appendSpace ().append (yComp )
48
- .appendSpace ().append (zComp )
43
+ .appendSpace ().append (coordComponent ( 'X' , loc . getX ()) )
44
+ .appendSpace ().append (coordComponent ( 'Y' , loc . getY ()) )
45
+ .appendSpace ().append (coordComponent ( 'Z' , loc . getZ ()) )
49
46
);
50
47
}
51
48
0 commit comments