diff --git a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/commands/PlayerArgument.java b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/commands/PlayerArgument.java index 836e0c4..ba1f00f 100644 --- a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/commands/PlayerArgument.java +++ b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/commands/PlayerArgument.java @@ -47,7 +47,7 @@ public CommandNode node() { .suggests((ctx, builder) -> { playerManager.getPlayers() .stream() - .limit(configurationContainer.get().getGeneralConfig().tabCompleteLimit()) + .limit(configurationContainer.get().tabCompleteLimit()) .forEach((player) -> builder.suggest( player.username(), VelocityBrigadierMessage.tooltip( diff --git a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Checks.java b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Checks.java index 1b23b2b..a12c38c 100644 --- a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Checks.java +++ b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Checks.java @@ -440,7 +440,8 @@ public static class Syntax implements Warning, Toggleable, Executable { @Setting(value = "warning-type") private WarningType warningType = WarningType.MESSAGE; - private Set allowedCommands = Set.of(); + @Comment("Allowed syntax command executions") + private Set allowedCommands = Set.of("luckperms"); @Override public CommandsConfig getCommandsConfig() { diff --git a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Configuration.java b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Configuration.java index 5443b77..935daac 100644 --- a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Configuration.java +++ b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/config/Configuration.java @@ -18,15 +18,15 @@ public final class Configuration implements Section { Check the function of each configuration option at https://github.com/4drian3d/ChatRegulator/wiki/Configuration"""; - @Comment("Format Module") - private Format format = new Format(); - - @Comment("General Configurations") - private General general = new General(); + @Comment("Formatter Module") + private Formatter formatter = new Formatter(); @Comment("CommandSpy configuration") private CommandSpy commandSpy = new CommandSpy(); + @Comment("Settings on the log of alert messages in console or files") + private Log log = new Log(); + @Comment(""" Specify in which commands you want the violations to be detected I recommend you to put chat commands, for example: /tell""") @@ -41,24 +41,50 @@ public final class Configuration implements Section { "reply" ); - public Set getCommandsChecked(){ - return this.commandsChecked; + @Comment("Set the maximum time in which a user's violations will be saved after the user leaves your server") + @Setting(value = "delete-users-after") + private long deleteUsersAfter = 30; + + @Comment(""" + Set the time unit of the delete-users-after setting + Available values: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS""") + @Setting(value = "time-unit") + private TimeUnit unit = TimeUnit.SECONDS; + + @Comment("Limit the amount of users showed on autocompletion") + @Setting(value = "tab-complete-limit") + private int limitTabComplete = 40; + + public long deleteUsersTime(){ + return this.deleteUsersAfter; + } + + public TimeUnit unit() { + return this.unit; + } + + public int tabCompleteLimit(){ + return this.limitTabComplete; } - public Format getFormatConfig(){ - return this.format; + public Set getCommandsChecked(){ + return this.commandsChecked; } - public General getGeneralConfig(){ - return this.general; + public Formatter getFormatterConfig(){ + return this.formatter; } public CommandSpy getCommandSpyConfig(){ return this.commandSpy; } + public Log getLog() { + return this.log; + } + @ConfigSerializable - public static class Format { + public static class Formatter { @Comment("Enable Format Module") private boolean enabled = false; @@ -106,31 +132,45 @@ public boolean shouldAnnounce(CommandSource source, String command){ } @ConfigSerializable - public static class General { - @Comment("Set the maximum time in which a user's violations will be saved after the user leaves your server") - @Setting(value = "delete-users-after") - private long deleteUsersAfter = 30; - - @Comment(""" - Set the time unit of the delete-users-after setting - Available values: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS""") - @Setting(value = "time-unit") - private TimeUnit unit = TimeUnit.SECONDS; - - @Comment("Limit the amount of users showed on autocompletion") - @Setting(value = "tab-complete-limit") - private int limitTabComplete = 40; + public static class Log { + @Comment("Toggle to show in console the alert message in case of check detection") + private boolean warningLog = true; + private File file = new File(); - public long deleteUsersTime(){ - return this.deleteUsersAfter; + public boolean warningLog() { + return warningLog; } - public TimeUnit unit() { - return this.unit; + public File getFile() { + return file; } - public int tabCompleteLimit(){ - return this.limitTabComplete; + @ConfigSerializable + public static class File { + @Comment("Sets whether this module will be activated") + private boolean enabled = false; + @Comment("Sets the format of the file in which the log will be written") + private String fileFormat = "'infractions'-dd-MM-yy'.txt'"; + @Comment("Sets the log format") + private String logFormat = "[