Implement toggle for command block logging (#2599)

Just a simple config toggle for whether or not command block commands should be logged.

closes #1153, closes #162

---

* Add toggle for command block logs
* update setting name
This commit is contained in:
triagonal 2019-08-06 01:17:22 +10:00 committed by md678685
parent ff9f712d65
commit 95f2852cf3
4 changed files with 21 additions and 1 deletions

View File

@ -487,7 +487,9 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
}
if (bSenderBlock != null) {
Bukkit.getLogger().log(Level.INFO, "CommandBlock at {0},{1},{2} issued server command: /{3} {4}", new Object[]{bSenderBlock.getX(), bSenderBlock.getY(), bSenderBlock.getZ(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
if (getSettings().logCommandBlockCommands()) {
Bukkit.getLogger().log(Level.INFO, "CommandBlock at {0},{1},{2} issued server command: /{3} {4}", new Object[]{bSenderBlock.getX(), bSenderBlock.getY(), bSenderBlock.getZ(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
}
} else if (user == null) {
Bukkit.getLogger().log(Level.INFO, "{0} issued server command: /{1} {2}", new Object[]{cSender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
}

View File

@ -330,4 +330,6 @@ public interface ISettings extends IConf {
boolean isWaterSafe();
boolean isSafeUsermap();
boolean logCommandBlockCommands();
}

View File

@ -554,6 +554,7 @@ public class Settings implements net.ess3.api.ISettings {
allowOldIdSigns = _allowOldIdSigns();
isWaterSafe = _isWaterSafe();
isSafeUsermap = _isSafeUsermap();
logCommandBlockCommands = _logCommandBlockCommands();
}
void _lateLoadItemSpawnBlacklist() {
@ -1576,4 +1577,15 @@ public class Settings implements net.ess3.api.ISettings {
public boolean isSafeUsermap() {
return isSafeUsermap;
}
private boolean logCommandBlockCommands;
private boolean _logCommandBlockCommands() {
return config.getBoolean("log-command-block-commands", true);
}
@Override
public boolean logCommandBlockCommands() {
return logCommandBlockCommands;
}
}

View File

@ -568,6 +568,10 @@ is-water-safe: false
# You should only change this to false if you use Minecraft China.
safe-usermap-names: true
# Should Essentials output logs when a command block executes a command?
# Example: CommandBlock at <x>,<y>,<z> issued server command: /<command>
log-command-block-commands: true
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #