mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Fixed /plan m import command #550
This commit is contained in:
parent
abcf2e877a
commit
b1ae7c53c7
@ -1,6 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.manage;
|
package com.djrapitops.plan.command.commands.manage;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.processing.importing.ImporterManager;
|
import com.djrapitops.plan.system.processing.importing.ImporterManager;
|
||||||
|
import com.djrapitops.plan.system.processing.importing.importers.Importer;
|
||||||
import com.djrapitops.plan.system.settings.Permissions;
|
import com.djrapitops.plan.system.settings.Permissions;
|
||||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||||
@ -38,20 +39,33 @@ public class ManageImportCommand extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
runImport("offlineimporter");
|
String importArg = args[0];
|
||||||
|
|
||||||
|
if (importArg.equals("list")) {
|
||||||
|
sender.sendMessage("Importers: ");
|
||||||
|
ImporterManager.getImporters().stream()
|
||||||
|
.map(Importer::getNames)
|
||||||
|
.map(list -> list.get(0))
|
||||||
|
.forEach(name -> sender.sendMessage("- " + name));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runImport(String importer) {
|
Importer importer = ImporterManager.getImporter(importArg);
|
||||||
RunnableFactory.createNew("Import", new AbsRunnable() {
|
if (importer == null) {
|
||||||
|
sender.sendMessage("§eImporter '" + importArg + "' doesn't exist");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunnableFactory.createNew("Import:" + importArg, new AbsRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
ImporterManager.getImporter(importer).processImport();
|
importer.processImport();
|
||||||
} finally {
|
} finally {
|
||||||
this.cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).runTaskAsynchronously();
|
}).runTaskAsynchronously();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user