From 3e6384cad9c4bdc2fdc1a614bdcafe9cbc1df4bb Mon Sep 17 00:00:00 2001 From: Will0376 <15551918+Will0376@users.noreply.github.com> Date: Wed, 17 Jun 2020 11:46:08 +0300 Subject: [PATCH] [FEATURE] SyncUPCommand (#396) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create SyncAll.java Выплёвываю как есть. Регистрация где - я хз. Дальше сами. * Update CommandHandler.java * Update and rename SyncAll.java to SyncUP.java * Update CommandHandler.java * Update and rename SyncUP.java to SyncUPCommand.java * Update CommandHandler.java --- .../command/handler/CommandHandler.java | 1 + .../command/hash/SyncUPCommand.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SyncUPCommand.java diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java index 45f01c24..77e74150 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java @@ -48,6 +48,7 @@ public static void registerCommands(pro.gravit.utils.command.CommandHandler hand updates.registerCommand("syncBinaries", new SyncBinariesCommand(server)); updates.registerCommand("syncUpdates", new SyncUpdatesCommand(server)); updates.registerCommand("syncProfiles", new SyncProfilesCommand(server)); + updates.registerCommand("syncUP", new SyncUPCommand(server)); updates.registerCommand("saveProfiles", new SaveProfilesCommand(server)); Category updatesCategory = new Category(updates, "updates", "Update and Sync Management"); handler.registerCategory(updatesCategory); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SyncUPCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SyncUPCommand.java new file mode 100644 index 00000000..83bb9c61 --- /dev/null +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SyncUPCommand.java @@ -0,0 +1,32 @@ +package pro.gravit.launchserver.command.hash; + +import pro.gravit.launchserver.LaunchServer; +import pro.gravit.launchserver.command.Command; +import pro.gravit.utils.helper.LogHelper; + +import java.io.IOException; + +public final class SyncUPCommand extends Command { + public SyncUPCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return null; + } + + @Override + public String getUsageDescription() { + return "Resync profiles & updates dirs"; + } + + @Override + public void invoke(String... args) throws IOException { + server.syncProfilesDir(); + LogHelper.subInfo("Profiles successfully resynced"); + + server.syncUpdatesDir(null); + LogHelper.subInfo("Updates dir successfully resynced"); + } +}