Rename and update errorShortcodeConverter setting

This commit is contained in:
JeremyStar™ 2024-10-15 13:16:59 +02:00
parent 8456e92a52
commit 0d5f19ee31
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 13 additions and 13 deletions

View file

@ -163,20 +163,20 @@ public final class EngineConfiguration extends Configuration {
/**
* If enabled, invalid shortcodes will be logged by the {@link ShortcodeParser}.
* The message will be printed as a {@link LogLevel#SILENT_WARNING}.
* If enabled, will cause {@link ShortcodeParser} to print
* invalid shortcodes as {@link LogLevel#SILENT_WARNING}s.
*
* @see ShortcodeParser
* @see #loggerLevel
* @since v1-alpha0
* -- GETTER --
* Gets the value for {@link #errorShortcodeConverter}.
* Gets the value for {@link #errorShortcodeParser}.
*
* @return variable value
* @see #errorShortcodeConverter
* @see #errorShortcodeParser
* @since v1-alpha0
*/
private boolean errorShortcodeConverter;
private boolean errorShortcodeParser;
/**
@ -372,7 +372,7 @@ public final class EngineConfiguration extends Configuration {
initialIncludeSubsystemClasses.addAll(Arrays.stream(parser.getString(group + property).split(",")).toList());
}
case "errorShortcodeConverter" -> errorShortcodeConverter = parser.getBoolean(group + property);
case "errorShortcodeParser" -> errorShortcodeParser = parser.getBoolean(group + property);
case "optimizeLogging" -> {
optimizeLogging = parser.getBoolean(group + property);
@ -420,7 +420,7 @@ public final class EngineConfiguration extends Configuration {
initialForceDisableClasspathScanning = false;
initialIncludeSubsystemClasses = new HashSet<>();
errorShortcodeConverter = true;
errorShortcodeParser = true;
optimizeLogging = true;
optimizeEvents = true;
@ -446,7 +446,7 @@ public final class EngineConfiguration extends Configuration {
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
case "errorShortcodeConverter" -> errorShortcodeConverter;
case "errorShortcodeParser" -> errorShortcodeParser;
case "optimizeLogging" -> optimizeLogging;
case "optimizeEvents" -> optimizeEvents;

View file

@ -92,7 +92,7 @@ public abstract class ShortcodeParser {
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
* @return list of components
* @throws ParserException on error
* @see EngineConfiguration#errorShortcodeConverter
* @see EngineConfiguration#errorShortcodeParser
* @since v1-alpha2
*/
protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
@ -133,7 +133,7 @@ public abstract class ShortcodeParser {
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
else {
// Complain about invalid shortcode
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text
@ -145,7 +145,7 @@ public abstract class ShortcodeParser {
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
else {
// Complain about invalid shortcode
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text
@ -173,7 +173,7 @@ public abstract class ShortcodeParser {
// error case
else {
// Complain about invalid shortcode
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text

View file

@ -52,7 +52,7 @@ class EngineConfigurationTest extends TestBase {
// Format: value (string), expected value
settings.put("debug", new Object[]{ "true", Boolean.TRUE });
settings.put("debugEvents", new Object[]{ "true", Boolean.TRUE });
settings.put("errorShortcodeConverter", new Object[]{ "false", Boolean.FALSE });
settings.put("errorShortcodeParser", new Object[]{ "false", Boolean.FALSE });
settings.put("loggerLevel", new Object[]{ "verbose", LogLevel.VERBOSE });
settings.put("loggerTemplate", new Object[]{ "%log_path% says: %message%", "%log_path% says: %message%" });
settings.put("loggerImmediateShutdown", new Object[]{ "true", Boolean.TRUE });