mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Language Updater: Put new lines at the end
This commit is contained in:
@@ -1297,9 +1297,11 @@ public class ConfigUpdater {
|
||||
"enableEncode: false",
|
||||
"encodeKey: 0");
|
||||
|
||||
addLinesAt(new String[] {"autosave:", "version:"}, 1, "",
|
||||
"# Debug Nachrichten im Log anzeigen [false]",
|
||||
"debug: false");
|
||||
if (indexOfStart("debug:") == -1) {
|
||||
addLinesAt(new String[]{"autosave:", "version:"}, 1, "",
|
||||
"# Debug Nachrichten im Log anzeigen [false]",
|
||||
"debug: false");
|
||||
}
|
||||
|
||||
index = indexOfStart("oldMat:") + 1;
|
||||
if (index == 0) {
|
||||
@@ -1396,9 +1398,11 @@ public class ConfigUpdater {
|
||||
"enableEncode: false",
|
||||
"encodeKey: 0");
|
||||
|
||||
addLinesAt(new String[] {"autosave:", "version:"}, 1, "",
|
||||
"# Show debug messages in log [false]",
|
||||
"debug: false");
|
||||
if (indexOfStart("debug:") == -1) {
|
||||
addLinesAt(new String[]{"autosave:", "version:"}, 1, "",
|
||||
"# Show debug messages in log [false]",
|
||||
"debug: false");
|
||||
}
|
||||
|
||||
index = indexOfStart("oldMat:") + 1;
|
||||
if (index == 0) {
|
||||
@@ -1495,9 +1499,11 @@ public class ConfigUpdater {
|
||||
"enableEncode: false",
|
||||
"encodeKey: 0");
|
||||
|
||||
addLinesAt(new String[] {"autosave:", "version:"}, 1, "",
|
||||
"# Show debug messages in log [false]",
|
||||
"debug: false");
|
||||
if (indexOfStart("debug:") == -1) {
|
||||
addLinesAt(new String[]{"autosave:", "version:"}, 1, "",
|
||||
"# Show debug messages in log [false]",
|
||||
"debug: false");
|
||||
}
|
||||
|
||||
index = indexOfStart("oldMat:") + 1;
|
||||
if (index == 0) {
|
||||
|
||||
@@ -38,7 +38,6 @@ public class LanguageReader {
|
||||
private void check(String defaultPath) {
|
||||
FileConfiguration defaults = null;
|
||||
ConfigUpdater updater = null;
|
||||
int i = 0;
|
||||
String line;
|
||||
InputStream resource = P.p.getResource(defaultPath);
|
||||
if (resource == null) return;
|
||||
@@ -46,18 +45,18 @@ public class LanguageReader {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
int index = line.indexOf(':');
|
||||
if (index != -1) {
|
||||
line = line.substring(0, index);
|
||||
if (!entries.containsKey(line)) {
|
||||
String key = line.substring(0, index);
|
||||
if (!entries.containsKey(key)) {
|
||||
if (defaults == null) {
|
||||
defaults = new YamlConfiguration();
|
||||
defaults.load(new BufferedReader(new InputStreamReader(Objects.requireNonNull(P.p.getResource(defaultPath)))));
|
||||
updater = new ConfigUpdater(file);
|
||||
updater.appendLines("", "# Updated");
|
||||
}
|
||||
entries.put(line, defaults.getString(line));
|
||||
updater.addLines(i, line + ": '" + entries.get(line) + "'");
|
||||
entries.put(key, defaults.getString(key));
|
||||
updater.appendLines(line);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (updater != null) {
|
||||
createBackup();
|
||||
|
||||
Reference in New Issue
Block a user