From 1540fecf93c11fb8859d0af7854f82bf54074519 Mon Sep 17 00:00:00 2001 From: takejohn <105504345+takejohn@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:26:05 +0900 Subject: [PATCH] Change first argument of containerTransactionsLookup to Location --- .../java/net/coreprotect/CoreProtectAPI.java | 4 +-- .../api/ContainerTransactionsAPI.java | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/coreprotect/CoreProtectAPI.java b/src/main/java/net/coreprotect/CoreProtectAPI.java index a36a9a38..ad29ec0f 100755 --- a/src/main/java/net/coreprotect/CoreProtectAPI.java +++ b/src/main/java/net/coreprotect/CoreProtectAPI.java @@ -216,9 +216,9 @@ public List blockLookup(Block block, int time) { return null; } - public List containerTransactionsLookup(Block block, int time) { + public List containerTransactionsLookup(Location location, int time) { if (Config.getGlobal().API_ENABLED) { - return ContainerTransactionsAPI.performLookup(block, time); + return ContainerTransactionsAPI.performLookup(location, time); } return null; } diff --git a/src/main/java/net/coreprotect/api/ContainerTransactionsAPI.java b/src/main/java/net/coreprotect/api/ContainerTransactionsAPI.java index 00bf8356..03db4d27 100644 --- a/src/main/java/net/coreprotect/api/ContainerTransactionsAPI.java +++ b/src/main/java/net/coreprotect/api/ContainerTransactionsAPI.java @@ -1,12 +1,5 @@ package net.coreprotect.api; -import net.coreprotect.CoreProtect; -import net.coreprotect.config.ConfigHandler; -import net.coreprotect.database.Database; -import net.coreprotect.database.statement.UserStatement; -import net.coreprotect.utility.Util; -import org.bukkit.block.Block; - import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.ResultSet; @@ -16,6 +9,14 @@ import java.util.List; import java.util.logging.Level; +import org.bukkit.Location; + +import net.coreprotect.CoreProtect; +import net.coreprotect.config.ConfigHandler; +import net.coreprotect.database.Database; +import net.coreprotect.database.statement.UserStatement; +import net.coreprotect.utility.Util; + public final class ContainerTransactionsAPI { private static final int CONNECTION_WAIT_TIME = 1000; @@ -24,19 +25,19 @@ private ContainerTransactionsAPI() { throw new AssertionError(); } - public static List performLookup(Block block, int offset) { + public static List performLookup(Location location, int offset) { List result = new ArrayList<>(); - if (block == null) { + if (location == null) { return result; } try (Connection connection = Database.getConnection(false, CONNECTION_WAIT_TIME)) { - final int x = block.getX(); - final int y = block.getY(); - final int z = block.getZ(); + final int x = (int) location.getX(); + final int y = (int) location.getY(); + final int z = (int) location.getZ(); final int now = (int) (System.currentTimeMillis() / 1000L); - final int worldId = Util.getWorldId(block.getWorld().getName()); + final int worldId = Util.getWorldId(location.getWorld().getName()); final int timeFrom = offset > 0 ? now - offset : 0; if (connection == null) {