|
3 | 3 | import org.jetbrains.annotations.NotNull; |
4 | 4 | import org.jvnet.hk2.annotations.Service; |
5 | 5 | import org.mvplugins.multiverse.core.command.MVCommandIssuer; |
6 | | -import org.mvplugins.multiverse.core.command.MVCommandManager; |
7 | 6 | import org.mvplugins.multiverse.core.command.queue.CommandQueueManager; |
8 | 7 | import org.mvplugins.multiverse.core.command.queue.CommandQueuePayload; |
9 | 8 | import org.mvplugins.multiverse.core.locale.message.Message; |
10 | | -import org.mvplugins.multiverse.external.acf.commands.annotation.CommandAlias; |
11 | 9 | import org.mvplugins.multiverse.external.acf.commands.annotation.CommandCompletion; |
12 | 10 | import org.mvplugins.multiverse.external.acf.commands.annotation.CommandPermission; |
13 | 11 | import org.mvplugins.multiverse.external.acf.commands.annotation.Description; |
|
22 | 20 | import static org.mvplugins.multiverse.core.locale.message.MessageReplacement.replace; |
23 | 21 |
|
24 | 22 | @Service |
25 | | -final class ImportCommand extends InventoriesCommand { |
| 23 | +final class MigrateCommand extends InventoriesCommand { |
26 | 24 |
|
27 | 25 | private final DataImportManager dataImportManager; |
28 | 26 | private final CommandQueueManager commandQueueManager; |
29 | 27 |
|
30 | 28 | @Inject |
31 | | - ImportCommand( |
| 29 | + MigrateCommand( |
32 | 30 | @NotNull DataImportManager dataImportManager, |
33 | 31 | @NotNull CommandQueueManager commandQueueManager |
34 | 32 | ) { |
35 | 33 | this.dataImportManager = dataImportManager; |
36 | 34 | this.commandQueueManager = commandQueueManager; |
37 | 35 | } |
38 | 36 |
|
39 | | - @Subcommand("import") |
| 37 | + @Subcommand("migrate") |
40 | 38 | @Syntax("<MultiInv|WorldInventories|PerWorldInventory>") |
41 | 39 | @CommandPermission("multiverse.inventories.import") |
42 | 40 | @CommandCompletion("@dataimporters") |
43 | 41 | @Description("Import inventories from MultiInv/WorldInventories/PerWorldInventory plugin.") |
44 | | - void onImportCommand( |
| 42 | + void onMigrateCommand( |
45 | 43 | MVCommandIssuer issuer, |
46 | 44 |
|
47 | 45 | @Single |
48 | 46 | @Syntax("<MultiInv|WorldInventories|PerWorldInventory>") |
49 | 47 | String pluginName) { |
50 | 48 |
|
51 | 49 | dataImportManager.getImporter(pluginName) |
52 | | - .onEmpty(() -> issuer.sendError(MVInvi18n.IMPORT_UNSUPPORTEDPLUGIN, replace("{plugin}").with(pluginName))) |
| 50 | + .onEmpty(() -> issuer.sendError(MVInvi18n.MIGRATE_UNSUPPORTEDPLUGIN, replace("{plugin}").with(pluginName))) |
53 | 51 | .peek(dataImporter -> { |
54 | 52 | if (!dataImporter.isEnabled()) { |
55 | | - issuer.sendError(MVInvi18n.IMPORT_PLUGINNOTENABLED, replace("{plugin}").with(pluginName)); |
| 53 | + issuer.sendError(MVInvi18n.MIGRATE_PLUGINNOTENABLED, replace("{plugin}").with(pluginName)); |
56 | 54 | return; |
57 | 55 | } |
58 | 56 | commandQueueManager.addToQueue(CommandQueuePayload.issuer(issuer) |
59 | | - .prompt(Message.of(MVInvi18n.IMPORT_CONFIRMPROMPT, replace("{plugin}").with(pluginName))) |
| 57 | + .prompt(Message.of(MVInvi18n.MIGRATE_CONFIRMPROMPT, replace("{plugin}").with(pluginName))) |
60 | 58 | .action(() -> doDataImport(issuer, dataImporter))); |
61 | 59 | }); |
62 | 60 | } |
63 | 61 |
|
64 | 62 | void doDataImport(MVCommandIssuer issuer, DataImporter dataImporter) { |
65 | 63 | if (dataImporter.importData()) { |
66 | | - issuer.sendInfo(MVInvi18n.IMPORT_SUCCESS, replace("{plugin}").with(dataImporter.getPluginName())); |
| 64 | + issuer.sendInfo(MVInvi18n.MIGRATE_SUCCESS, replace("{plugin}").with(dataImporter.getPluginName())); |
67 | 65 | } else { |
68 | | - issuer.sendError(MVInvi18n.IMPORT_FAILED, replace("{plugin}").with(dataImporter.getPluginName())); |
| 66 | + issuer.sendError(MVInvi18n.MIGRATE_FAILED, replace("{plugin}").with(dataImporter.getPluginName())); |
69 | 67 | } |
70 | 68 | } |
71 | 69 | } |
0 commit comments