mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Offload importer registration from initialization
This commit is contained in:
3 files changed
+13
No files matched your search
@@ -225,6 +225,11 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
|
|||||||
if (isDependencyLoaded("PlaceholderAPI")) {
|
if (isDependencyLoaded("PlaceholderAPI")) {
|
||||||
getHooks().add(new PlaceholderAPIHook(this));
|
getHooks().add(new PlaceholderAPIHook(this));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerImporters() {
|
||||||
|
HuskHomes.super.registerImporters();
|
||||||
|
|
||||||
// Importers
|
// Importers
|
||||||
if (isDependencyLoaded("Essentials")) {
|
if (isDependencyLoaded("Essentials")) {
|
||||||
|
|||||||
@@ -341,6 +341,9 @@ public interface HuskHomes extends TaskRunner, EventDispatcher, SafetyResolver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void registerImporters() {
|
||||||
|
}
|
||||||
|
|
||||||
boolean isDependencyLoaded(@NotNull String name);
|
boolean isDependencyLoaded(@NotNull String name);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class HuskHomesCommand extends Command implements TabProvider {
|
|||||||
"update", true
|
"update", true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private boolean importersLoaded = false;
|
||||||
private final UpdateChecker updateChecker;
|
private final UpdateChecker updateChecker;
|
||||||
private final AboutMenu aboutMenu;
|
private final AboutMenu aboutMenu;
|
||||||
|
|
||||||
@@ -117,6 +118,10 @@ public class HuskHomesCommand extends Command implements TabProvider {
|
|||||||
plugin.getVersion().toString()).ifPresent(executor::sendMessage);
|
plugin.getVersion().toString()).ifPresent(executor::sendMessage);
|
||||||
});
|
});
|
||||||
case "import" -> {
|
case "import" -> {
|
||||||
|
if (!importersLoaded) {
|
||||||
|
importersLoaded = true;
|
||||||
|
plugin.registerImporters();
|
||||||
|
}
|
||||||
if (plugin.getImporters().isEmpty()) {
|
if (plugin.getImporters().isEmpty()) {
|
||||||
plugin.getLocales().getLocale("error_no_importers_available")
|
plugin.getLocales().getLocale("error_no_importers_available")
|
||||||
.ifPresent(executor::sendMessage);
|
.ifPresent(executor::sendMessage);
|
||||||
|
|||||||
Reference in new issue
Block a user