mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 10:15:52 +01:00
Don't rewrite files with no placeholders
This commit is contained in:
parent
fe4f19e713
commit
08b56fc823
@ -156,10 +156,20 @@ public class ReplacementScanner {
|
||||
String string = Util.readAll(new InputStreamReader(stream));
|
||||
stream.close();
|
||||
|
||||
for (Map.Entry<String, String> replacement : replacements.entrySet()) string = string.replace("SubServers::" + replacement.getKey(), replacement.getValue());
|
||||
FileWriter writer = new FileWriter(file, false);
|
||||
writer.write(string);
|
||||
writer.close();
|
||||
boolean update = false;
|
||||
for (Map.Entry<String, String> replacement : replacements.entrySet()) {
|
||||
String placeholder = "SubServers::" + replacement.getKey();
|
||||
if (string.contains(placeholder)) {
|
||||
string = string.replace(placeholder, replacement.getValue());
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (update) {
|
||||
FileWriter writer = new FileWriter(file, false);
|
||||
writer.write(string);
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,6 +128,7 @@ public final class SubCommand extends CommandX {
|
||||
case "system":
|
||||
case "bungee":
|
||||
case "bungeecord":
|
||||
case "subdata":
|
||||
case "network":
|
||||
plugin.getPluginManager().dispatchCommand(ConsoleCommandSender.getInstance(), "greload");
|
||||
break;
|
||||
@ -137,7 +138,6 @@ public final class SubCommand extends CommandX {
|
||||
case "servers":
|
||||
case "subserver":
|
||||
case "subservers":
|
||||
case "subdata":
|
||||
case "config":
|
||||
case "configs":
|
||||
try {
|
||||
|
@ -156,10 +156,20 @@ public class ReplacementScanner {
|
||||
String string = Util.readAll(new InputStreamReader(stream));
|
||||
stream.close();
|
||||
|
||||
for (Map.Entry<String, String> replacement : replacements.entrySet()) string = string.replace("SubServers::" + replacement.getKey(), replacement.getValue());
|
||||
FileWriter writer = new FileWriter(file, false);
|
||||
writer.write(string);
|
||||
writer.close();
|
||||
boolean update = false;
|
||||
for (Map.Entry<String, String> replacement : replacements.entrySet()) {
|
||||
String placeholder = "SubServers::" + replacement.getKey();
|
||||
if (string.contains(placeholder)) {
|
||||
string = string.replace(placeholder, replacement.getValue());
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (update) {
|
||||
FileWriter writer = new FileWriter(file, false);
|
||||
writer.write(string);
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user