From aeec60f9f01eaf15d0829f7e3fbb72c3c5f1a2d5 Mon Sep 17 00:00:00 2001 From: CJ Burkey Date: Wed, 28 Aug 2024 23:40:13 -0400 Subject: [PATCH] Update some comments --- .../data/sqlite/SqLiteDataHandler.java | 7 ----- .../claimchunk/data/sqlite/SqLiteWrapper.java | 2 ++ .../cjburkey/claimchunk/flag/FlagHandler.java | 2 ++ src/main/resources/flags.yml | 26 ++++++++++++------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteDataHandler.java b/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteDataHandler.java index aabdc21..f334d3c 100644 --- a/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteDataHandler.java +++ b/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteDataHandler.java @@ -16,13 +16,6 @@ import java.util.*; import java.util.stream.Collectors; -/* - * I've actually just decided that we're gonna do it this way: - * - SQLite backing database *file* similar to current MySQL integration (which will - * be removed and automatically converted). - * - Have some intermediary layer that can Respond immediately and asynchronously update database. - */ - /** * The SHINY, NEW........data handler that tries to fix the data loss issues by which this project * has been plagued since its conception. diff --git a/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteWrapper.java b/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteWrapper.java index 29fb97e..3fb3c54 100644 --- a/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteWrapper.java +++ b/src/main/java/com/cjburkey/claimchunk/data/sqlite/SqLiteWrapper.java @@ -20,6 +20,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +// TODO: REPLACE CHUNK_ID KEY WITH CHUNK COORDINATE KEY + public record SqLiteWrapper(File dbFile, boolean usesTransactionManager) implements Closeable { private static final String SELECT_CHUNK_ID_SQL = diff --git a/src/main/java/com/cjburkey/claimchunk/flag/FlagHandler.java b/src/main/java/com/cjburkey/claimchunk/flag/FlagHandler.java index 344569a..f518d58 100644 --- a/src/main/java/com/cjburkey/claimchunk/flag/FlagHandler.java +++ b/src/main/java/com/cjburkey/claimchunk/flag/FlagHandler.java @@ -118,6 +118,8 @@ private ApplicableFlags getApplicableFlags( return new ApplicableFlags(chunkPlayerFlags, chunkFlags, playerFlags, globalFlags); } + // TODO: RETURN FlagProtectResult.Unspecified TO ALLOW WORLD PROFILE + // FALLBACK. private boolean doesProtect( ApplicableFlags applicableFlags, String flagName, CCFlags.ProtectWhen protectWhen) { FlagProtectResult result; diff --git a/src/main/resources/flags.yml b/src/main/resources/flags.yml index 35c37ca..75e5e13 100644 --- a/src/main/resources/flags.yml +++ b/src/main/resources/flags.yml @@ -2,12 +2,13 @@ # enable/disable in their chunks to determine what other are allowed to do in # their claimed chunk(s). # -# When a user has a flag enabled, it overrides all more specific flag targets +# When a user has a flag enabled, it overrides all less specific flag targets # even when they're disabled. So for example, if a user has some `interact` -# flag enabled for one of their chunks, it does not matter if they have it -# disabled for a specific player (either globally or in that chunk). -# This may end up being a big foot-gun! This should be changed to some -# "enabled/disabled/unset" system +# flag specifically enabled/disabled for one of their chunks, it does not +# matter if they have it enabled/disabled for a specific player, unless they +# have the flag as a different value for that player in the specific chunk. +# If all flags are unset, the fallback is determined by the world's protection +# profile file in the `/plugins/ClaimChunk/worlds/` directory. # # When specifying included/excluded blocks and entities, you can use either the # resource name (like `minecraft:dirt`, for example), the Spigot/Bukkit @@ -16,13 +17,13 @@ # Class references (preceded by `@`) reference the classes described in: # /plugins/ClaimChunk/classes.yml # -# By default, blocks/entities listed in flags will have protection from other +# By default, blocks/entities listed in flags will have PROTECTION from other # players *enabled* when the flag is disabled! # The `protectWhen` value can be used within each protection type list. # If set to `ENABLED`, the protections will only be applied once the owner has # enabled the flag for their claim(s). # For an example, see the `disablePvp` flag below, which protects player -# entities once the flag has been enabled, rather than by default. +# entities once the flag has been enabled, rather than once disabled. permissionFlags: breakBlocks: @@ -35,6 +36,8 @@ permissionFlags: # entities/entity classes will be included. # Similarly, `exclude` includes all default blocks/items and # excludes the provided ones. + # If both are provided, exclusions are processed FIRST and then + # inclusions type: BREAK placeBlocks: - for: BLOCKS @@ -42,7 +45,9 @@ permissionFlags: interactBlocks: - for: BLOCKS type: INTERACT - exclude: ['@REDSTONE', '@DOORS', '@CONTAINER'] # Handle these separately + # Handle these separately. + # Note: @CONTAINER blocks are covered by the `containers` flag below + exclude: ['@REDSTONE', '@DOORS', '@CONTAINER'] redstone: - for: BLOCKS type: INTERACT @@ -55,10 +60,12 @@ permissionFlags: # Entities damageEntities: - for: ENTITIES + # Entities can have DAMAGE, INTERACT, and EXPLODE protection types type: DAMAGE interactEntities: - for: ENTITIES type: INTERACT + # Handle container entities with container blocks in the `containers` flag exclude: ['@VEHICLES', '@CONTAINER_ENTITIES'] vehicles: - for: ENTITIES @@ -70,11 +77,12 @@ permissionFlags: # PVP is unique, set the `for` to `PLAYERS`: - for: PLAYERS protectWhen: ENABLED + # Ender pearls are another unique target disablePearl: - for: PEARLS protectWhen: ENABLED - # Can also handle both types with one flag + # Can also handle multiple types with one flag containers: - for: BLOCKS type: INTERACT