forked from StarOpenSource/Engine
Rename and update errorShortcodeConverter setting
This commit is contained in:
parent
8456e92a52
commit
0d5f19ee31
3 changed files with 13 additions and 13 deletions
|
@ -163,20 +163,20 @@ public final class EngineConfiguration extends Configuration {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If enabled, invalid shortcodes will be logged by the {@link ShortcodeParser}.
|
* If enabled, will cause {@link ShortcodeParser} to print
|
||||||
* The message will be printed as a {@link LogLevel#SILENT_WARNING}.
|
* invalid shortcodes as {@link LogLevel#SILENT_WARNING}s.
|
||||||
*
|
*
|
||||||
* @see ShortcodeParser
|
* @see ShortcodeParser
|
||||||
* @see #loggerLevel
|
* @see #loggerLevel
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #errorShortcodeConverter}.
|
* Gets the value for {@link #errorShortcodeParser}.
|
||||||
*
|
*
|
||||||
* @return variable value
|
* @return variable value
|
||||||
* @see #errorShortcodeConverter
|
* @see #errorShortcodeParser
|
||||||
* @since v1-alpha0
|
* @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());
|
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" -> {
|
case "optimizeLogging" -> {
|
||||||
optimizeLogging = parser.getBoolean(group + property);
|
optimizeLogging = parser.getBoolean(group + property);
|
||||||
|
@ -420,7 +420,7 @@ public final class EngineConfiguration extends Configuration {
|
||||||
initialForceDisableClasspathScanning = false;
|
initialForceDisableClasspathScanning = false;
|
||||||
initialIncludeSubsystemClasses = new HashSet<>();
|
initialIncludeSubsystemClasses = new HashSet<>();
|
||||||
|
|
||||||
errorShortcodeConverter = true;
|
errorShortcodeParser = true;
|
||||||
|
|
||||||
optimizeLogging = true;
|
optimizeLogging = true;
|
||||||
optimizeEvents = true;
|
optimizeEvents = true;
|
||||||
|
@ -446,7 +446,7 @@ public final class EngineConfiguration extends Configuration {
|
||||||
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
|
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
|
||||||
case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
|
case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
|
||||||
|
|
||||||
case "errorShortcodeConverter" -> errorShortcodeConverter;
|
case "errorShortcodeParser" -> errorShortcodeParser;
|
||||||
|
|
||||||
case "optimizeLogging" -> optimizeLogging;
|
case "optimizeLogging" -> optimizeLogging;
|
||||||
case "optimizeEvents" -> optimizeEvents;
|
case "optimizeEvents" -> optimizeEvents;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public abstract class ShortcodeParser {
|
||||||
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
|
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
|
||||||
* @return list of components
|
* @return list of components
|
||||||
* @throws ParserException on error
|
* @throws ParserException on error
|
||||||
* @see EngineConfiguration#errorShortcodeConverter
|
* @see EngineConfiguration#errorShortcodeParser
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
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());
|
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
|
||||||
else {
|
else {
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
|
@ -145,7 +145,7 @@ public abstract class ShortcodeParser {
|
||||||
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
|
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
|
||||||
else {
|
else {
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
|
@ -173,7 +173,7 @@ public abstract class ShortcodeParser {
|
||||||
// error case
|
// error case
|
||||||
else {
|
else {
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
|
|
|
@ -52,7 +52,7 @@ class EngineConfigurationTest extends TestBase {
|
||||||
// Format: value (string), expected value
|
// Format: value (string), expected value
|
||||||
settings.put("debug", new Object[]{ "true", Boolean.TRUE });
|
settings.put("debug", new Object[]{ "true", Boolean.TRUE });
|
||||||
settings.put("debugEvents", 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("loggerLevel", new Object[]{ "verbose", LogLevel.VERBOSE });
|
||||||
settings.put("loggerTemplate", new Object[]{ "%log_path% says: %message%", "%log_path% says: %message%" });
|
settings.put("loggerTemplate", new Object[]{ "%log_path% says: %message%", "%log_path% says: %message%" });
|
||||||
settings.put("loggerImmediateShutdown", new Object[]{ "true", Boolean.TRUE });
|
settings.put("loggerImmediateShutdown", new Object[]{ "true", Boolean.TRUE });
|
||||||
|
|
Loading…
Reference in a new issue