Add queued async threading.

This commit is contained in:
Brianna 2020-04-18 09:35:17 -04:00
parent 0afc6dc38e
commit b4256c49cf
2 changed files with 2 additions and 2 deletions

View File

@ -205,7 +205,7 @@ public class EpicHoppers extends SongodaPlugin {
} }
final boolean convrted = converted; final boolean convrted = converted;
getDataManager().sync(() -> { getDataManager().queueAsync(() -> {
if (convrted) if (convrted)
console.sendMessage("[" + getDescription().getName() + "] " + ChatColor.GREEN + "Conversion complete :)"); console.sendMessage("[" + getDescription().getName() + "] " + ChatColor.GREEN + "Conversion complete :)");
// Load data from DB // Load data from DB

View File

@ -146,7 +146,7 @@ public class DataManager extends DataManagerAbstract {
} }
public void createHopper(Hopper hopper) { public void createHopper(Hopper hopper) {
this.sync(() -> this.databaseConnector.connect(connection -> { this.queueAsync(() -> this.databaseConnector.connect(connection -> {
String createHopper = "INSERT INTO " + this.getTablePrefix() + "placed_hoppers (level, placed_by, last_opened_by, teleport_trigger, world, x, y, z) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; String createHopper = "INSERT INTO " + this.getTablePrefix() + "placed_hoppers (level, placed_by, last_opened_by, teleport_trigger, world, x, y, z) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
try (PreparedStatement statement = connection.prepareStatement(createHopper)) { try (PreparedStatement statement = connection.prepareStatement(createHopper)) {
statement.setInt(1, hopper.getLevel().getLevel()); statement.setInt(1, hopper.getLevel().getLevel());