mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2026-01-04 15:31:37 +00:00
Echest, invsee
This commit is contained in:
@@ -6,10 +6,7 @@ import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.general.GeneralSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import net.william278.husksync.command.BukkitCommand;
|
||||
import net.william278.husksync.command.CommandBase;
|
||||
import net.william278.husksync.command.HuskSyncCommand;
|
||||
import net.william278.husksync.command.Permission;
|
||||
import net.william278.husksync.command.*;
|
||||
import net.william278.husksync.config.Locales;
|
||||
import net.william278.husksync.config.Settings;
|
||||
import net.william278.husksync.data.CompressedDataAdapter;
|
||||
@@ -17,6 +14,7 @@ import net.william278.husksync.data.DataAdapter;
|
||||
import net.william278.husksync.data.JsonDataAdapter;
|
||||
import net.william278.husksync.database.Database;
|
||||
import net.william278.husksync.database.MySqlDatabase;
|
||||
import net.william278.husksync.editor.DataEditor;
|
||||
import net.william278.husksync.listener.BukkitEventListener;
|
||||
import net.william278.husksync.listener.EventListener;
|
||||
import net.william278.husksync.player.BukkitPlayer;
|
||||
@@ -51,6 +49,8 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
|
||||
|
||||
private DataAdapter dataAdapter;
|
||||
|
||||
private DataEditor dataEditor;
|
||||
|
||||
private Settings settings;
|
||||
|
||||
private Locales locales;
|
||||
@@ -97,6 +97,7 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
|
||||
return loadedSettings;
|
||||
}).join();
|
||||
}).thenApply(succeeded -> {
|
||||
// Prepare data adapter
|
||||
if (succeeded) {
|
||||
if (settings.getBooleanValue(Settings.ConfigOption.SYNCHRONIZATION_COMPRESS_DATA)) {
|
||||
dataAdapter = new CompressedDataAdapter();
|
||||
@@ -105,6 +106,12 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
|
||||
}
|
||||
}
|
||||
return succeeded;
|
||||
}).thenApply(succeeded -> {
|
||||
// Prepare data editor
|
||||
if (succeeded) {
|
||||
dataEditor = new DataEditor();
|
||||
}
|
||||
return succeeded;
|
||||
}).thenApply(succeeded -> {
|
||||
// Establish connection to the database
|
||||
this.database = new MySqlDatabase(settings, resourceReader, logger, dataAdapter);
|
||||
@@ -160,11 +167,10 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
|
||||
})));
|
||||
|
||||
// Register commands
|
||||
final CommandBase[] commands = new CommandBase[]{new HuskSyncCommand(this)};
|
||||
for (CommandBase commandBase : commands) {
|
||||
final PluginCommand pluginCommand = getCommand(commandBase.command);
|
||||
for (final BukkitCommandType bukkitCommandType : BukkitCommandType.values()) {
|
||||
final PluginCommand pluginCommand = getCommand(bukkitCommandType.commandBase.command);
|
||||
if (pluginCommand != null) {
|
||||
new BukkitCommand(commandBase, this).register(pluginCommand);
|
||||
new BukkitCommand(bukkitCommandType.commandBase, this).register(pluginCommand);
|
||||
}
|
||||
}
|
||||
getLoggingAdapter().log(Level.INFO, "Successfully registered permissions & commands");
|
||||
@@ -226,6 +232,11 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
|
||||
return dataAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull DataEditor getDataEditor() {
|
||||
return dataEditor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Settings getSettings() {
|
||||
return settings;
|
||||
|
||||
Reference in New Issue
Block a user