From 2b48b5e17fbeb21f2d1c2834d273b5b290e1121a Mon Sep 17 00:00:00 2001 From: CJ Burkey Date: Fri, 3 May 2024 15:28:26 -0400 Subject: [PATCH] Quick fix --- .../chunk/ChunkPlayerPermissions.java | 17 ++++++++++++----- .../cjburkey/claimchunk/cmd/MainHandler.java | 3 +-- .../data/newdata/MySQLDataHandler.java | 8 ++++---- .../smartcommand/sub/ply/UnclaimAllCmd.java | 7 +------ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/cjburkey/claimchunk/chunk/ChunkPlayerPermissions.java b/src/main/java/com/cjburkey/claimchunk/chunk/ChunkPlayerPermissions.java index 9b9f397..7d75b08 100644 --- a/src/main/java/com/cjburkey/claimchunk/chunk/ChunkPlayerPermissions.java +++ b/src/main/java/com/cjburkey/claimchunk/chunk/ChunkPlayerPermissions.java @@ -45,6 +45,7 @@ private void setAllow(int mask, boolean allow) { public boolean canBreak() { return checkMask(Masks.BREAK); } + public void allowBreak(final boolean allow) { setAllow(Masks.BREAK, allow); } @@ -52,6 +53,7 @@ public void allowBreak(final boolean allow) { public boolean canPlace() { return checkMask(Masks.PLACE); } + public void allowPlace(final boolean allow) { setAllow(Masks.PLACE, allow); } @@ -59,6 +61,7 @@ public void allowPlace(final boolean allow) { public boolean canUseDoors() { return checkMask(Masks.DOOR); } + public void allowUseDoors(final boolean allow) { setAllow(Masks.DOOR, allow); } @@ -66,6 +69,7 @@ public void allowUseDoors(final boolean allow) { public boolean canUseRedstone() { return checkMask(Masks.REDSTONE); } + public void allowUseRedstone(final boolean allow) { setAllow(Masks.REDSTONE, allow); } @@ -73,6 +77,7 @@ public void allowUseRedstone(final boolean allow) { public boolean canUseVehicles() { return checkMask(Masks.VEHICLE); } + public void allowUseVehicles(final boolean allow) { setAllow(Masks.VEHICLE, allow); } @@ -80,6 +85,7 @@ public void allowUseVehicles(final boolean allow) { public boolean canInteractEntities() { return checkMask(Masks.INTERACT_ENTITY); } + public void allowInteractEntities(final boolean allow) { setAllow(Masks.INTERACT_ENTITY, allow); } @@ -87,6 +93,7 @@ public void allowInteractEntities(final boolean allow) { public boolean canInteractBlocks() { return checkMask(Masks.INTERACT_BLOCK); } + public void allowInteractBlocks(final boolean allow) { setAllow(Masks.INTERACT_BLOCK, allow); } @@ -94,6 +101,7 @@ public void allowInteractBlocks(final boolean allow) { public boolean canUseContainers() { return checkMask(Masks.CONTAINERS); } + public void allowUseContainers(final boolean allow) { setAllow(Masks.CONTAINERS, allow); } @@ -113,7 +121,8 @@ public Map toPermissionsMap() { return permissionsMap; } - public static @NotNull ChunkPlayerPermissions fromPermissionsMap(@NotNull Map permissions) { + public static @NotNull ChunkPlayerPermissions fromPermissionsMap( + @NotNull Map permissions) { ChunkPlayerPermissions chunkPlayerPermissions = new ChunkPlayerPermissions(); for (Map.Entry perm : permissions.entrySet()) { @@ -124,10 +133,8 @@ public Map toPermissionsMap() { case "doors" -> chunkPlayerPermissions.allowUseDoors(permVal); case "redstone" -> chunkPlayerPermissions.allowUseRedstone(permVal); case "interactVehicles" -> chunkPlayerPermissions.allowUseVehicles(permVal); - case "interactEntities" -> - chunkPlayerPermissions.allowInteractEntities(permVal); - case "interactBlocks" -> - chunkPlayerPermissions.allowInteractBlocks(permVal); + case "interactEntities" -> chunkPlayerPermissions.allowInteractEntities(permVal); + case "interactBlocks" -> chunkPlayerPermissions.allowInteractBlocks(permVal); case "useContainers" -> chunkPlayerPermissions.allowUseContainers(permVal); } } diff --git a/src/main/java/com/cjburkey/claimchunk/cmd/MainHandler.java b/src/main/java/com/cjburkey/claimchunk/cmd/MainHandler.java index ad93aae..b7d2ddb 100644 --- a/src/main/java/com/cjburkey/claimchunk/cmd/MainHandler.java +++ b/src/main/java/com/cjburkey/claimchunk/cmd/MainHandler.java @@ -138,8 +138,7 @@ public void claimChunk(Player p, Chunk loc) { loc.getWorld(), loc.getX(), loc.getZ(), - p.getUniqueId() - ); + p.getUniqueId()); // Error check, though it *shouldn't* occur if (pos == null) { diff --git a/src/main/java/com/cjburkey/claimchunk/data/newdata/MySQLDataHandler.java b/src/main/java/com/cjburkey/claimchunk/data/newdata/MySQLDataHandler.java index 4b57898..df0a051 100644 --- a/src/main/java/com/cjburkey/claimchunk/data/newdata/MySQLDataHandler.java +++ b/src/main/java/com/cjburkey/claimchunk/data/newdata/MySQLDataHandler.java @@ -760,7 +760,7 @@ public void givePlayerAccess( ACCESS_ACCESS_ID); try (PreparedStatement updateStatement = prep(claimChunk, connection, updateStatementSql)) { - updateStatement.setInt(1, permissions.getPermissionFlags()); + updateStatement.setInt(1, permissions.permissionFlags); updateStatement.setInt(2, result.getInt(1)); updateStatement.execute(); @@ -782,7 +782,7 @@ public void givePlayerAccess( insertStatement.setInt(1, chunkId); insertStatement.setString(2, chunkOwner); insertStatement.setString(3, accessor.toString()); - insertStatement.setInt(4, permissions.getPermissionFlags()); + insertStatement.setInt(4, permissions.permissionFlags); insertStatement.execute(); } @@ -843,8 +843,8 @@ public void writeAccessAssociationsBulk(DataChunk[] chunks) { statement.setInt(6 * i + 3, c.chunk.z()); statement.setString(6 * i + 4, c.player.toString()); statement.setString(6 * i + 5, entry.getKey().toString()); - statement.setInt(6 * i + 6, entry.getValue().getPermissionFlags()); - statement.setInt(6 * i + 6, entry.getValue().getPermissionFlags()); + statement.setInt(6 * i + 6, entry.getValue().permissionFlags); + statement.setInt(6 * i + 6, entry.getValue().permissionFlags); i++; } } diff --git a/src/main/java/com/cjburkey/claimchunk/smartcommand/sub/ply/UnclaimAllCmd.java b/src/main/java/com/cjburkey/claimchunk/smartcommand/sub/ply/UnclaimAllCmd.java index 26c7756..2e7edbd 100644 --- a/src/main/java/com/cjburkey/claimchunk/smartcommand/sub/ply/UnclaimAllCmd.java +++ b/src/main/java/com/cjburkey/claimchunk/smartcommand/sub/ply/UnclaimAllCmd.java @@ -46,12 +46,7 @@ public boolean onCall(@NotNull String cmdUsed, @NotNull CommandSender executor, && claimChunk .getMainHandler() .unclaimChunk( - false, - true, - player, - chunk.world(), - chunk.x(), - chunk.z())) { + false, true, player, chunk.world(), chunk.x(), chunk.z())) { unclaimed++; } }