chore: pre-commit changes [skip ci]

This commit is contained in:
github-actions[bot] 2024-11-20 04:40:49 +00:00
parent 9f23a617ff
commit ce1715436e
4 changed files with 34 additions and 37 deletions

View File

@ -114,7 +114,7 @@ public class ConfigRepositoryImpl implements ConfigRepository {
public void loadConfig(DataStorage dataStorage) {
this.dataStorage = dataStorage;
this.config = dataStorage.loadFile(Config.class, "config.yaml");
if(config == null) {
if (config == null) {
this.config = new Config();
}
}

View File

@ -15,7 +15,6 @@ import com.sekwah.advancedportals.spigot.connector.container.SpigotServerContain
import com.sekwah.advancedportals.spigot.importer.LegacyImporter;
import com.sekwah.advancedportals.spigot.metrics.Metrics;
import com.sekwah.advancedportals.spigot.warpeffects.SpigotWarpEffects;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -97,7 +96,8 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
File destiFolder = new File(this.getDataFolder(), "desti");
if (destiFile.exists() && !destiFolder.exists()) {
destiFolder.mkdirs();
getLogger().info("Importing old destinations from destinations.yaml");
getLogger().info(
"Importing old destinations from destinations.yaml");
LegacyImporter.importDestinations(this.destinationServices);
}

View File

@ -10,12 +10,10 @@ import com.sekwah.advancedportals.shadowed.inject.Inject;
import com.sekwah.advancedportals.spigot.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.spigot.importer.ConfigAccessor;
import com.sekwah.advancedportals.spigot.importer.LegacyImporter;
import java.util.List;
import java.util.Set;
public class ImportPortalSubCommand implements SubCommand {
@Inject
DestinationServices destinationServices;
@ -28,7 +26,8 @@ public class ImportPortalSubCommand implements SubCommand {
sender.sendMessage(Lang.getPositivePrefix()
+ Lang.translateInsertVariables(
"command.portal.import.confirm"));
int destinations = LegacyImporter.importDestinations(destinationServices);
int destinations =
LegacyImporter.importDestinations(destinationServices);
int portals = LegacyImporter.importPortals(portalServices);
sender.sendMessage(
Lang.getPositivePrefix()

View File

@ -6,14 +6,12 @@ import com.sekwah.advancedportals.core.serializeddata.PlayerLocation;
import com.sekwah.advancedportals.core.services.DestinationServices;
import com.sekwah.advancedportals.core.services.PortalServices;
import com.sekwah.advancedportals.spigot.AdvancedPortalsPlugin;
import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
public class LegacyImporter {
private LegacyImporter() {
}
@ -105,7 +103,8 @@ public class LegacyImporter {
return count;
}
public static int importDestinations(DestinationServices destinationServices) {
public static int importDestinations(
DestinationServices destinationServices) {
ConfigAccessor destiConfig = new ConfigAccessor(
AdvancedPortalsPlugin.getInstance(), "destinations.yml");
var config = destiConfig.getConfig();
@ -137,5 +136,4 @@ public class LegacyImporter {
}
return null;
}
}