mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Fully async EssentialsMigrator
This commit is contained in:
1 parent
74fd90c37f
commit
58eeab20c5
2 files changed
+3
-5
No files matched your search
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.William278</groupId>
|
<groupId>me.William278</groupId>
|
||||||
<artifactId>HuskHomes</artifactId>
|
<artifactId>HuskHomes</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>2.7.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HuskHomes</name>
|
<name>HuskHomes</name>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class EssentialsMigrator {
|
|||||||
|
|
||||||
// Migrate data from EssentialsX
|
// Migrate data from EssentialsX
|
||||||
public static void migrate(final String worldFilter, final String targetServer) {
|
public static void migrate(final String worldFilter, final String targetServer) {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
final File essentialsDataFolder = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials");
|
final File essentialsDataFolder = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials");
|
||||||
|
|
||||||
if (essentialsDataFolder.exists()) {
|
if (essentialsDataFolder.exists()) {
|
||||||
@@ -56,7 +57,6 @@ public class EssentialsMigrator {
|
|||||||
final String playerName = playerFileConfig.getString("last-account-name", playerFileConfig.getString("lastAccountName"));
|
final String playerName = playerFileConfig.getString("last-account-name", playerFileConfig.getString("lastAccountName"));
|
||||||
try {
|
try {
|
||||||
Connection connection = HuskHomes.getConnection();
|
Connection connection = HuskHomes.getConnection();
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
|
||||||
try {
|
try {
|
||||||
if (!DataManager.playerExists(playerUUID, connection)) {
|
if (!DataManager.playerExists(playerUUID, connection)) {
|
||||||
DataManager.createPlayer(playerUUID, playerName, connection);
|
DataManager.createPlayer(playerUUID, playerName, connection);
|
||||||
@@ -106,7 +106,6 @@ public class EssentialsMigrator {
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred migrating Essentials home data.", e);
|
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred migrating Essentials home data.", e);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
} catch (NullPointerException ignored) { }
|
} catch (NullPointerException ignored) { }
|
||||||
} catch (IllegalArgumentException ignored) { }
|
} catch (IllegalArgumentException ignored) { }
|
||||||
@@ -121,7 +120,6 @@ public class EssentialsMigrator {
|
|||||||
|
|
||||||
if (warpFiles != null) {
|
if (warpFiles != null) {
|
||||||
Connection connection = HuskHomes.getConnection();
|
Connection connection = HuskHomes.getConnection();
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
|
||||||
for (File warpFile : warpFiles) {
|
for (File warpFile : warpFiles) {
|
||||||
try {
|
try {
|
||||||
final FileConfiguration warpFileConfig = loadConfiguration(warpFile);
|
final FileConfiguration warpFileConfig = loadConfiguration(warpFile);
|
||||||
@@ -163,7 +161,6 @@ public class EssentialsMigrator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,5 +209,6 @@ public class EssentialsMigrator {
|
|||||||
plugin.getLogger().warning("Failed to Migrate from Essentials!");
|
plugin.getLogger().warning("Failed to Migrate from Essentials!");
|
||||||
Bukkit.getLogger().warning("Could not find Essentials plugin data to migrate!");
|
Bukkit.getLogger().warning("Could not find Essentials plugin data to migrate!");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user