Skip to content

Commit

Permalink
Quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cjburkey01 committed May 3, 2024
1 parent d593350 commit 2b48b5e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,55 +45,63 @@ private void setAllow(int mask, boolean allow) {
public boolean canBreak() {
return checkMask(Masks.BREAK);
}

public void allowBreak(final boolean allow) {
setAllow(Masks.BREAK, allow);
}

public boolean canPlace() {
return checkMask(Masks.PLACE);
}

public void allowPlace(final boolean allow) {
setAllow(Masks.PLACE, allow);
}

public boolean canUseDoors() {
return checkMask(Masks.DOOR);
}

public void allowUseDoors(final boolean allow) {
setAllow(Masks.DOOR, allow);
}

public boolean canUseRedstone() {
return checkMask(Masks.REDSTONE);
}

public void allowUseRedstone(final boolean allow) {
setAllow(Masks.REDSTONE, allow);
}

public boolean canUseVehicles() {
return checkMask(Masks.VEHICLE);
}

public void allowUseVehicles(final boolean allow) {
setAllow(Masks.VEHICLE, allow);
}

public boolean canInteractEntities() {
return checkMask(Masks.INTERACT_ENTITY);
}

public void allowInteractEntities(final boolean allow) {
setAllow(Masks.INTERACT_ENTITY, allow);
}

public boolean canInteractBlocks() {
return checkMask(Masks.INTERACT_BLOCK);
}

public void allowInteractBlocks(final boolean allow) {
setAllow(Masks.INTERACT_BLOCK, allow);
}

public boolean canUseContainers() {
return checkMask(Masks.CONTAINERS);
}

public void allowUseContainers(final boolean allow) {
setAllow(Masks.CONTAINERS, allow);
}
Expand All @@ -113,7 +121,8 @@ public Map<String, Boolean> toPermissionsMap() {
return permissionsMap;
}

public static @NotNull ChunkPlayerPermissions fromPermissionsMap(@NotNull Map<String, Boolean> permissions) {
public static @NotNull ChunkPlayerPermissions fromPermissionsMap(
@NotNull Map<String, Boolean> permissions) {
ChunkPlayerPermissions chunkPlayerPermissions = new ChunkPlayerPermissions();

for (Map.Entry<String, Boolean> perm : permissions.entrySet()) {
Expand All @@ -124,10 +133,8 @@ public Map<String, Boolean> 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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/cjburkey/claimchunk/cmd/MainHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down Expand Up @@ -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++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down

0 comments on commit 2b48b5e

Please sign in to comment.