added and implemented taskchain

This commit is contained in:
2024-10-04 20:42:17 +02:00
parent 4f4a6aef10
commit ab71f09f8a
12 changed files with 130 additions and 102 deletions
@@ -68,11 +68,11 @@ public class PixelBlockDatabase {
}
public void deletePixelBlock(PixelBlock pixelBlock) {
Bukkit.getScheduler().runTaskAsynchronously(PixelBlocksPlugin.plugin, () -> {
Bukkit.getScheduler().runTaskAsynchronously(Main.plugin, () -> {
try {
this.deletePixelBlock.setString(1, pixelBlock.blockUUID.toString());
this.deletePixelBlock.executeUpdate();
PixelBlocksPlugin.plugin.getLogger().info("DB: Deleted PixelBlock: " + pixelBlock.blockUUID);
Main.plugin.getLogger().info("DB: Deleted PixelBlock: " + pixelBlock.blockUUID);
} catch (SQLException e) {
throw new RuntimeException("Failed to delete PixelBlock", e);
}
@@ -80,7 +80,7 @@ public class PixelBlockDatabase {
}
public void savePixelBlock(PixelBlock pixelBlock) {
Bukkit.getScheduler().runTask(PixelBlocksPlugin.plugin, () -> {
Bukkit.getScheduler().runTask(Main.plugin, () -> {
List<UUID> storedPixelBlocks = new ArrayList<>();
try {
@@ -118,7 +118,7 @@ public class PixelBlockDatabase {
this.insertNewPixelBlock.setString(11, pixelBlock.facingDirection.toString());
this.insertNewPixelBlock.executeUpdate();
PixelBlocksPlugin.plugin.getLogger().info("DB: Created PixelBlock: " + pixelBlock.blockUUID);
Main.plugin.getLogger().info("DB: Created PixelBlock: " + pixelBlock.blockUUID);
} catch (SQLException e) {
throw new RuntimeException("Failed to save PixelBlock", e);
}
@@ -149,7 +149,7 @@ public class PixelBlockDatabase {
this.updateExistingPixelBlock.setString(11, pixelBlock.facingDirection.toString());
this.updateExistingPixelBlock.executeUpdate();
PixelBlocksPlugin.plugin.getLogger().info("DB: Updated PixelBlock: " + pixelBlock.blockUUID);
Main.plugin.getLogger().info("DB: Updated PixelBlock: " + pixelBlock.blockUUID);
} catch (SQLException e) {
throw new RuntimeException("Failed updating PixelBlock", e);
}
@@ -183,7 +183,7 @@ public class PixelBlockDatabase {
Direction.valueOf(allPixelBlocks.getString("direction"))
);
block.setLastEntryLocation(entryLocation);
PixelBlocksPlugin.plugin.getLogger().info("DB: Loaded PixelBlock: " + block.blockUUID);
Main.plugin.getLogger().info("DB: Loaded PixelBlock: " + block.blockUUID);
}
} catch (SQLException e) {
throw new RuntimeException("Failed loading PixelBlocks", e);