12
12
import dev .rollczi .litecommands .annotations .join .Join ;
13
13
import dev .rollczi .litecommands .annotations .permission .Permission ;
14
14
import org .bukkit .Server ;
15
+ import org .bukkit .command .CommandSender ;
15
16
import org .bukkit .entity .Player ;
16
17
17
18
@ FeatureDocs (name = "Spy sudo" , description = "Allows you to spy on other players' sudo commands execution, permission to spy: eternalcore.sudo.spy" )
@@ -32,22 +33,23 @@ class SudoCommand {
32
33
@ DescriptionDocs (description = "Execute command as console" , arguments = "<command>" )
33
34
void console (@ Context Viewer viewer , @ Join String command ) {
34
35
this .server .dispatchCommand (this .server .getConsoleSender (), command );
35
- this .sendSudoSpy (viewer , command );
36
+ this .sendSudoSpy (viewer , this . server . getConsoleSender (), command );
36
37
}
37
38
38
39
@ Execute
39
40
@ Permission ("eternalcore.sudo.player" )
40
41
@ DescriptionDocs (description = "Execute command as player" , arguments = "<player> <command>" )
41
42
void player (@ Context Viewer viewer , @ Arg Player target , @ Join String command ) {
42
43
this .server .dispatchCommand (target , command );
43
- this .sendSudoSpy (viewer , command );
44
+ this .sendSudoSpy (viewer , target , command );
44
45
}
45
46
46
- private void sendSudoSpy (Viewer viewer , String command ) {
47
+ private void sendSudoSpy (Viewer viewer , CommandSender target , String command ) {
47
48
this .noticeService .create ()
48
49
.notice (translation -> translation .sudo ().sudoMessage ())
49
50
.placeholder ("{COMMAND}" , command )
50
51
.placeholder ("{PLAYER}" , viewer .getName ())
52
+ .placeholder ("{TARGET}" , target .getName ())
51
53
.viewer (viewer )
52
54
.send ();
53
55
@@ -57,6 +59,7 @@ private void sendSudoSpy(Viewer viewer, String command) {
57
59
.notice (translation -> translation .sudo ().sudoMessageSpy ())
58
60
.placeholder ("{COMMAND}" , command )
59
61
.placeholder ("{PLAYER}" , viewer .getName ())
62
+ .placeholder ("{TARGET}" , target .getName ())
60
63
.player (player .getUniqueId ())
61
64
.send ());
62
65
}
0 commit comments