mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
fixed bug where duplicate comments with leading whitespace were ignored
This commit is contained in:
parent
5d2028b5dc
commit
db0ae36fa7
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.208</version>
|
<version>2.1.209-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -11,7 +11,9 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class BukkitConfig {
|
public abstract class BukkitConfig {
|
||||||
public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 1";
|
public static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:";
|
||||||
|
public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2";
|
||||||
|
public static final char COMMENT_PREFIX = '#';
|
||||||
protected final String fileName;
|
protected final String fileName;
|
||||||
protected final File configFile;
|
protected final File configFile;
|
||||||
protected YamlConfiguration config;
|
protected YamlConfiguration config;
|
||||||
@ -149,7 +151,11 @@ public abstract class BukkitConfig {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.startsWith("#")) {
|
//Older version, don't append this line
|
||||||
|
if(line.startsWith(CONFIG_PATCH_PREFIX))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (isFirstCharAsciiCharacter(line, COMMENT_PREFIX)) {
|
||||||
if(seenBefore.contains(line))
|
if(seenBefore.contains(line))
|
||||||
dupedLines++;
|
dupedLines++;
|
||||||
else
|
else
|
||||||
@ -189,4 +195,19 @@ public abstract class BukkitConfig {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFirstCharAsciiCharacter(String line, char character) {
|
||||||
|
if(line == null || line.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Character c : line.toCharArray()) {
|
||||||
|
if(c.equals(' '))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return c.equals(character);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user