[F] Команда Json*PermissionsHandler - save

This commit is contained in:
Gravit 2019-08-25 14:34:42 +07:00
parent 248450373a
commit ebfc7351dd
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 26 additions and 1 deletions

View file

@ -52,6 +52,19 @@ public void invoke(String... args) throws Exception {
} }
}; };
commands.put("reload", reload); commands.put("reload", reload);
commands.put("save", new SubCommand() {
@Override
public void invoke(String... args) throws Exception {
Path path = Paths.get(filename);
if (!IOHelper.exists(path)) {
try (Writer writer = IOHelper.newWriter(path)) {
Launcher.gsonManager.gson.toJson(map, writer);
} catch (IOException e) {
LogHelper.error(e);
}
}
}
});
return commands; return commands;
} }

View file

@ -53,6 +53,19 @@ public void invoke(String... args) throws Exception {
} }
}; };
commands.put("reload", reload); commands.put("reload", reload);
commands.put("save", new SubCommand() {
@Override
public void invoke(String... args) throws Exception {
Path path = Paths.get(filename);
if (!IOHelper.exists(path)) {
try (Writer writer = IOHelper.newWriter(path)) {
Launcher.gsonManager.gson.toJson(map, writer);
} catch (IOException e) {
LogHelper.error(e);
}
}
}
});
return commands; return commands;
} }

View file

@ -52,7 +52,6 @@ public void invoke(String... args) throws Exception {
commands.put("clearExclude", new SubCommand() { commands.put("clearExclude", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) throws Exception {
verifyArgs(args, 1);
exclude.clear(); exclude.clear();
} }
}); });