Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,9 @@ public boolean onCommandEssentials(final CommandSender cSender, final Command co
LOGGER.log(Level.INFO, "CommandBlock at " + bSenderBlock.getX() + "," + bSenderBlock.getY() + "," + bSenderBlock.getZ() + " issued server command: /" + commandLabel + " " + EssentialsCommand.getFinalArg(args, 0));
}
} else if (user == null) {
LOGGER.log(Level.INFO, cSender.getName()+ " issued server command: /" + commandLabel + " " + EssentialsCommand.getFinalArg(args, 0));
if (getSettings().logConsoleRconCommands()) {
LOGGER.log(Level.INFO, cSender.getName()+ " issued server command: /" + commandLabel + " " + EssentialsCommand.getFinalArg(args, 0));
}
Comment on lines -750 to +752
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should be checking if cSender is an instance of RemoteConsoleCommandSender instead? won't this catch console messages too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's intended behavior, i meant for this to catch both console and RCON commands. i can change this to use separate config options if you'd like

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm okay, i think we should rename the config option to log-console-command over specifically rcon then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

}

final CommandSource sender = new CommandSource(this, cSender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ public interface ISettings extends IConf {

boolean logCommandBlockCommands();

boolean logConsoleRconCommands();

Set<Predicate<String>> getNickBlacklist();

double getMaxProjectileSpeed();
Expand Down
11 changes: 11 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public class Settings implements net.ess3.api.ISettings {
private boolean isWaterSafe;
private boolean isSafeUsermap;
private boolean logCommandBlockCommands;
private boolean logConsoleRconCommands;
private Set<Predicate<String>> nickBlacklist;
private double maxProjectileSpeed;
private boolean removeEffectsOnHeal;
Expand Down Expand Up @@ -930,6 +931,7 @@ public void reloadConfig() {
isWaterSafe = _isWaterSafe();
isSafeUsermap = _isSafeUsermap();
logCommandBlockCommands = _logCommandBlockCommands();
logConsoleRconCommands = _logConsoleRconCommands();
nickBlacklist = _getNickBlacklist();
maxProjectileSpeed = _getMaxProjectileSpeed();
removeEffectsOnHeal = _isRemovingEffectsOnHeal();
Expand Down Expand Up @@ -2084,6 +2086,15 @@ public boolean logCommandBlockCommands() {
return logCommandBlockCommands;
}

private boolean _logConsoleRconCommands() {
return config.getBoolean("log-console-rcon-commands", true);
}

@Override
public boolean logConsoleRconCommands() {
return logConsoleRconCommands;
}

private Set<Predicate<String>> _getNickBlacklist() {
final Set<Predicate<String>> blacklist = new HashSet<>();

Expand Down
4 changes: 4 additions & 0 deletions Essentials/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ safe-usermap-names: true
# Example: CommandBlock at <x>,<y>,<z> issued server command: /<command>
log-command-block-commands: true

# Should Essentials output logs when the console or RCON executes a command?
# Example: CONSOLE issued server command: /<command>
log-console-rcon-commands: true

# Set the maximum speed for projectiles spawned with /fireball.
max-projectile-speed: 8

Expand Down