Skip to content

Commit bf38704

Browse files
authored
GH-919 Fix sudo placeholder's (#919)
1 parent 615022b commit bf38704

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

eternalcore-core/src/main/java/com/eternalcode/core/feature/sudo/SudoCommand.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import dev.rollczi.litecommands.annotations.join.Join;
1313
import dev.rollczi.litecommands.annotations.permission.Permission;
1414
import org.bukkit.Server;
15+
import org.bukkit.command.CommandSender;
1516
import org.bukkit.entity.Player;
1617

1718
@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 {
3233
@DescriptionDocs(description = "Execute command as console", arguments = "<command>")
3334
void console(@Context Viewer viewer, @Join String command) {
3435
this.server.dispatchCommand(this.server.getConsoleSender(), command);
35-
this.sendSudoSpy(viewer, command);
36+
this.sendSudoSpy(viewer, this.server.getConsoleSender(), command);
3637
}
3738

3839
@Execute
3940
@Permission("eternalcore.sudo.player")
4041
@DescriptionDocs(description = "Execute command as player", arguments = "<player> <command>")
4142
void player(@Context Viewer viewer, @Arg Player target, @Join String command) {
4243
this.server.dispatchCommand(target, command);
43-
this.sendSudoSpy(viewer, command);
44+
this.sendSudoSpy(viewer, target, command);
4445
}
4546

46-
private void sendSudoSpy(Viewer viewer, String command) {
47+
private void sendSudoSpy(Viewer viewer, CommandSender target, String command) {
4748
this.noticeService.create()
4849
.notice(translation -> translation.sudo().sudoMessage())
4950
.placeholder("{COMMAND}", command)
5051
.placeholder("{PLAYER}", viewer.getName())
52+
.placeholder("{TARGET}", target.getName())
5153
.viewer(viewer)
5254
.send();
5355

@@ -57,6 +59,7 @@ private void sendSudoSpy(Viewer viewer, String command) {
5759
.notice(translation -> translation.sudo().sudoMessageSpy())
5860
.placeholder("{COMMAND}", command)
5961
.placeholder("{PLAYER}", viewer.getName())
62+
.placeholder("{TARGET}", target.getName())
6063
.player(player.getUniqueId())
6164
.send());
6265
}

eternalcore-core/src/main/java/com/eternalcode/core/feature/sudo/messages/ENSudoMessages.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
@Accessors(fluent = true)
1111
@Contextual
1212
public class ENSudoMessages implements SudoMessages {
13-
@Description({"# {PLAYER} - Player who executed the command, {COMMAND} - Command that the player executed"})
14-
public Notice sudoMessageSpy =
15-
Notice.chat("<dark_gray>[<dark_red>Sudo<dark_gray>] <red>{PLAYER}<dark_gray> executed command: <white>{COMMAND}");
16-
public Notice sudoMessage =
17-
Notice.chat("<green>► <white>You executed command: <green>{COMMAND} <white>on player: <green>{PLAYER}");
13+
@Description({"# {PLAYER} - Player who executed the command, {TARGET} - Player or console on which the command was executed, {COMMAND} - Command"})
14+
public Notice sudoMessageSpy = Notice.chat("<dark_gray>[<dark_red>Sudo<dark_gray>] <red>{PLAYER}<dark_gray> executed command: <white>{COMMAND} <dark_gray>on: <white>{TARGET}");
15+
16+
@Description({"# {TARGET} - Player or console on which the command was executed, {COMMAND} - Command"})
17+
public Notice sudoMessage = Notice.chat("<green>► <white>You executed command: <green>{COMMAND} <white>on: <green>{TARGET}");
1818
}

eternalcore-core/src/main/java/com/eternalcode/core/feature/sudo/messages/PLSudoMessages.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
@Accessors(fluent = true)
1111
@Contextual
1212
public class PLSudoMessages implements SudoMessages {
13-
@Description({"# {PLAYER} - Gracz który wykonał komendę, {COMMAND} - Komenda, którą wykonał gracz"})
14-
public Notice sudoMessageSpy =
15-
Notice.chat("<dark_gray>[<dark_red>Sudo<dark_gray>] <red>{PLAYER}<dark_gray> wykonał komendę: <white>{COMMAND}");
16-
public Notice sudoMessage =
17-
Notice.chat("<green>► <white>Wykonałeś komendę: <green>{COMMAND} <white>na graczu: <green>{PLAYER}");
13+
@Description({"# {PLAYER} - Gracz, który wykonał komendę, {TARGET} - Gracz lub konsola, na której wykonano komendę, {COMMAND} - Komenda"})
14+
public Notice sudoMessageSpy = Notice.chat("<dark_gray>[<dark_red>Sudo<dark_gray>] <red>{PLAYER}<dark_gray> wykonał komendę: <white>{COMMAND} <dark_gray>na: <white>{TARGET}");
15+
16+
@Description({"# {TARGET} - Gracz lub konsola, na której wykonano komendę, {COMMAND} - Komenda"})
17+
public Notice sudoMessage = Notice.chat("<green>► <white>Wykonałeś komendę: <green>{COMMAND} <white>na: <green>{TARGET}");
1818
}

0 commit comments

Comments
 (0)