Skip to content

Commit

Permalink
Fixed console commands in config slots
Browse files Browse the repository at this point in the history
  • Loading branch information
0ft3n committed Jan 22, 2024
1 parent 74a8dce commit b6b4d7e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private SlotHandler dispatchCommandHandler(@NotNull final String configKey) {
for (String command : config.getStrings(configKey)) {
if (command.startsWith("console:")) {
commands.add(new CommandToDispatch(
StringUtils.removePrefix("console:", command),
StringUtils.removePrefix(command, "console:"),
true
));
} else {
Expand Down Expand Up @@ -127,12 +127,16 @@ private record CommandToDispatch(
* @param player The player.
*/
void dispatch(@NotNull final Player player) {
System.out.println("DISPATCHING " + command);

if (console()) {
System.out.println("CONSOLE");
Bukkit.dispatchCommand(
Bukkit.getConsoleSender(),
command().replace("%player%", player.getName())
);
} else {
System.out.println("NON-CONSOLE");
Bukkit.dispatchCommand(
player,
command().replace("%player%", player.getName())
Expand Down

0 comments on commit b6b4d7e

Please sign in to comment.