mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-29 21:54:16 +01:00
Add queued async threading.
This commit is contained in:
parent
0afc6dc38e
commit
b4256c49cf
@ -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
|
||||||
|
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user