Ignore comment lines on custom menu entry swapper (#721)
Any line that starts with // will be ignored, giving you the ability to categorize your swaps. 
This commit is contained in:
@@ -1309,7 +1309,17 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
if (!Strings.isNullOrEmpty(config))
|
||||
{
|
||||
Map<String, String> split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (String str : config.split("\n"))
|
||||
{
|
||||
if (!str.startsWith("//"))
|
||||
{
|
||||
sb.append(str + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
|
||||
|
||||
for (Map.Entry<String, String> entry : split.entrySet())
|
||||
{
|
||||
|
||||
@@ -32,12 +32,22 @@ public class Parse
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (String str : value.split("\n"))
|
||||
{
|
||||
if (!str.startsWith("//"))
|
||||
{
|
||||
sb.append(str + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
Splitter NEWLINE_SPLITTER = Splitter
|
||||
.on("\n")
|
||||
.omitEmptyStrings()
|
||||
.trimResults();
|
||||
|
||||
NEWLINE_SPLITTER.withKeyValueSeparator(':').split(value);
|
||||
NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb);
|
||||
return true;
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
|
||||
Reference in New Issue
Block a user