From 32844cf7933779990c4a4f3a7a440fc169a6ed68 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Mon, 24 Jan 2022 12:07:28 -0500 Subject: [PATCH 1/4] Move area protection durations to per-world config --- pom.xml | 28 +++ .../gpclaimexpiration/EvaluationManager.java | 8 +- .../gpclaimexpiration/GPClaimExpiration.java | 132 +------------- .../UnprotectedPetAbandoner.java | 4 +- .../config/Configuration.java | 168 ++++++++++++++++++ .../config/TreeMapSetting.java | 64 +++++++ .../listener/WarningListener.java | 4 +- src/main/resources/config.yml | 22 +++ 8 files changed, 297 insertions(+), 133 deletions(-) create mode 100644 src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java create mode 100644 src/main/java/com/github/gpaddons/gpclaimexpiration/config/TreeMapSetting.java diff --git a/pom.xml b/pom.xml index e088c34..669affb 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,12 @@ 1.7.1 provided + + com.github.jikoo + planarwrappers + 2.2.4 + compile + @@ -82,6 +88,28 @@ 8 + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + true + + + com.github.jikoo.planarwrappers + com.github.gpaddons.gpclaimexpiration.planarwrappers + + + + + + diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java index db04898..692c651 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java @@ -99,7 +99,7 @@ private void checkNextPlayer() OfflinePlayer player = plugin.getServer().getOfflinePlayer(playerUUID); // Ensure player is not exempt from claim expiration. - if (plugin.isExempt(player)) return; + if (plugin.config().isExempt(player)) return; GriefPrevention.AddLogEntry(String.format("[GPClaimExpiration] %s is not exempt from expiration.", playerUUID), CustomLogEntryTypes.Debug, true); @@ -107,7 +107,7 @@ private void checkNextPlayer() long timeSinceLastSession = System.currentTimeMillis() - plugin.getLastQualifyingSession(player); // Ensure last qualifying session is before the earliest time any claim could expire. - if (timeSinceLastSession <= plugin.getShortestClaimExpiration()) return; + if (timeSinceLastSession <= plugin.config().getShortestClaimExpiration()) return; GriefPrevention.AddLogEntry(String.format( "[GPClaimExpiration] %s has not been online for %s days, claims may be eligible to delete.", @@ -141,7 +141,7 @@ private void evaluateClaims(@NotNull OfflinePlayer player, long timeSinceLastSes private void evaluateClaim(@NotNull Claim claim, long timeSinceLastSession) { - if (timeSinceLastSession <= plugin.getProtectionDuration(claim)) return; + if (timeSinceLastSession <= plugin.config().getProtectionDuration(claim)) return; GriefPrevention.AddLogEntry(String.format("[GPClaimExpiration] %s has an area of %s and is eligible for delete", claim.getID(), claim.getArea()), CustomLogEntryTypes.Debug, true); @@ -162,7 +162,7 @@ private void evaluateClaim(@NotNull Claim claim, long timeSinceLastSession) claim.getID(), claim.ownerID), CustomLogEntryTypes.Debug, false); // Fetch delete commands. - List commandList = plugin.getCommandList("expiration.claim.commands", new ClaimReplacement(claim)); + List commandList = plugin.config().getCommandList("expiration.claim.commands", new ClaimReplacement(claim)); // Delete claim. GriefPrevention.instance.dataStore.deleteClaim(claim, true); diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java index d24bf05..a53c979 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java @@ -1,29 +1,16 @@ package com.github.gpaddons.gpclaimexpiration; +import com.github.gpaddons.gpclaimexpiration.config.Configuration; import com.github.gpaddons.gpclaimexpiration.lang.Message; import com.github.gpaddons.gpclaimexpiration.listener.LegacyWarningListener; import com.github.gpaddons.gpclaimexpiration.listener.ModernWarningListener; import com.github.gpaddons.util.VaultBridge; import com.github.gpaddons.util.lang.Lang; -import com.github.gpaddons.util.lang.MessageReplacement; -import me.ryanhamshire.GriefPrevention.Claim; -import me.ryanhamshire.GriefPrevention.GriefPrevention; -import me.ryanhamshire.GriefPrevention.PlayerData; import org.bukkit.OfflinePlayer; -import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.TreeMap; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; -import java.util.stream.Collectors; - /** * A Bukkit plugin for improved expiration of GriefPrevention claims. */ @@ -31,7 +18,7 @@ public class GPClaimExpiration extends JavaPlugin { private final VaultBridge vault = new VaultBridge(this); - private final TreeMap areaProtectionDuration = new TreeMap<>(); + private Configuration config; @Override public void onEnable() @@ -39,7 +26,7 @@ public void onEnable() saveDefaultConfig(); // Load configured claim durations. - loadAreaDurations(); + this.config = new Configuration(this); // Unregister existing listeners. HandlerList.unregisterAll(this); @@ -69,41 +56,6 @@ public void onEnable() new EvaluationManager(this).startScheduling(); } - /** - * Get protection durations in milliseconds mapped to claim area. - * - * @return a Map containing durations in milliseconds related to area measurements - */ - public @NotNull Map getProtectionDurations() - { - return Collections.unmodifiableMap(areaProtectionDuration); - } - - /** - * Get the shortest expiration time across all claim areas or {@link Long#MAX_VALUE} if no times are configured. - * - * @return the shortest claim expiration - */ - public long getShortestClaimExpiration() - { - Optional shortestExpirationTime = areaProtectionDuration.values().stream().sorted().findFirst(); - - return shortestExpirationTime.orElse(Long.MAX_VALUE); - } - - /** - * Get the expiration time for the closest configured area equal to or less than the Claim's area. - * If no times are available at or below the area, {@link Long#MAX_VALUE} is returned instead. - * - * @return the Claim's protection duration - */ - public long getProtectionDuration(@NotNull Claim claim) - { - final Map.Entry areaProtection = areaProtectionDuration.floorEntry(claim.getArea()); - - return areaProtection != null ? areaProtection.getValue() : Long.MAX_VALUE; - } - /** * Gets a player's last qualifying online session timestamp. * @@ -118,84 +70,14 @@ public long getLastQualifyingSession(@NotNull OfflinePlayer player) return player.getLastPlayed(); } - /** - * Check whether or not a player is exempt from expiration. - * - * @param player the OfflinePlayer to check - * @return true if the player is exempt from expiration - */ - public boolean isExempt(@NotNull OfflinePlayer player) + public @NotNull Configuration config() { - if (player.isOnline()) return true; - - PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()); - - if (exceedsConfigInt("expiration.bypass.claim_blocks", playerData::getAccruedClaimBlocks)) return true; - - if (exceedsConfigInt("expiration.bypass.bonus_claim_blocks", playerData::getBonusClaimBlocks)) return true; - - return getConfig().getStringList("expiration.bypass.permissions").stream() - .anyMatch(permission -> vault.hasPermission(player, permission)); + return config; } - private void loadAreaDurations() + public VaultBridge getPermissionBridge() { - areaProtectionDuration.clear(); - - ConfigurationSection areaDays = getConfig().getConfigurationSection("expiration.days_per_area"); - - if (areaDays == null) return; - - for (String areaString : areaDays.getKeys(false)) - { - int volume; - - // Parse volume. - try - { - volume = Integer.parseInt(areaString); - } - catch (NumberFormatException e) - { - getLogger().warning(String.format("Invalid area size %s - must be a whole number!", areaString)); - continue; - } - - // Get configured duration. - long duration = areaDays.getLong(areaString, -1); - - // Treat values < 0 as eternal. - if (duration < 0) - duration = Long.MAX_VALUE; - else - duration = TimeUnit.MILLISECONDS.convert(duration, TimeUnit.DAYS); - - areaProtectionDuration.put(volume, duration); - } - - } - - private boolean exceedsConfigInt(@NotNull String path, @NotNull Supplier integerSupplier) - { - int configValue = getConfig().getInt(path, -1); - - if (configValue < 0) return false; - - return configValue <= integerSupplier.get(); - } - - @NotNull List getCommandList(@NotNull String key, MessageReplacement @NotNull ... replacements) - { - List list = getConfig().getStringList(key); - - if (list.isEmpty()) return list; - - return list.stream().map(command -> { - for (MessageReplacement replacement : replacements) { - command = replacement.replace(command); - } - return command; - }).collect(Collectors.toList()); + return vault; } } diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java index 8991ba4..e781011 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java @@ -90,7 +90,7 @@ private void onPetInteract(@Nullable Player actor, @NotNull Entity entity) if (claim != null && claim.getPermission(owner.getUniqueId().toString()) != null) return; // Ensure pet owner is not exempt from expiration. - if (plugin.isExempt(owner)) return; + if (plugin.config().isExempt(owner)) return; // Ensure pet owner's last play session was long enough ago to expire pet ownership. if (plugin.getLastQualifyingSession(owner) >= System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS)) return; @@ -132,7 +132,7 @@ private void onPetInteract(@Nullable Player actor, @NotNull Entity entity) } // Run pet abandonment commands. - for (String command : plugin.getCommandList("expiration.pets.commands", + for (String command : plugin.config().getCommandList("expiration.pets.commands", new OwnerReplacement(owner), new LocationReplacement(tameable.getLocation()))) { plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command); diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java new file mode 100644 index 0000000..9bb91b2 --- /dev/null +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java @@ -0,0 +1,168 @@ +package com.github.gpaddons.gpclaimexpiration.config; + +import com.github.gpaddons.gpclaimexpiration.GPClaimExpiration; +import com.github.gpaddons.util.lang.MessageReplacement; +import com.github.jikoo.planarwrappers.config.Setting; +import me.ryanhamshire.GriefPrevention.Claim; +import me.ryanhamshire.GriefPrevention.GriefPrevention; +import me.ryanhamshire.GriefPrevention.PlayerData; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Map; +import java.util.NavigableMap; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +public class Configuration +{ + + private final GPClaimExpiration plugin; + private final Setting> areaProtectionDuration; + + public Configuration(GPClaimExpiration plugin) + { + this.plugin = plugin; + + + TreeMap defaults = new TreeMap<>(); + defaults.put(250_000, Long.MAX_VALUE); + defaults.put(10_000, TimeUnit.MILLISECONDS.convert(90, TimeUnit.DAYS)); + defaults.put(1_000, TimeUnit.MILLISECONDS.convert(60, TimeUnit.DAYS)); + defaults.put(0, 0L); + + areaProtectionDuration = new TreeMapSetting(plugin.getConfig(), "expiration.days_per_area", defaults) + { + @Override + protected @Nullable Integer convertKey(@NotNull String key) + { + try + { + return Integer.parseInt(key); + } + catch (NumberFormatException e) + { + plugin.getLogger().warning(String.format("Invalid area size %s - must be a whole number!", key)); + return null; + } + } + + @Override + protected @NotNull Long convertValue(@NotNull String value) + { + try + { + int days = Integer.parseInt(value); + + if (days < 0) return Long.MAX_VALUE; + + return TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS); + } + catch (NumberFormatException e) + { + plugin.getLogger().warning(String.format("Invalid day count %s - must be a whole number!", value)); + return Long.MAX_VALUE; + } + } + }; + } + + /** + * Get protection durations in milliseconds mapped to claim area. + * + * @return a Map containing durations in milliseconds related to area measurements + */ + public @NotNull Setting> getProtectionDurations() + { + return areaProtectionDuration; + } + + /** + * Get the shortest expiration time across all claim areas or {@link Long#MAX_VALUE} if no times are configured. + * + * @return the shortest claim expiration + */ + public long getShortestClaimExpiration() + { + Optional shortestExpirationTime = plugin.getServer().getWorlds().stream() + .map(world -> areaProtectionDuration.get(world.getName())) + .flatMap(map -> map.values().stream()) + .sorted() + .filter(value -> value > 0) + .findFirst(); + + return shortestExpirationTime.orElse(Long.MAX_VALUE); + } + + /** + * Get the expiration time for the closest configured area equal to or less than the Claim's area. + * If no times are available at or below the area, {@link Long#MAX_VALUE} is returned instead. + * + * @return the Claim's protection duration + */ + public long getProtectionDuration(@NotNull Claim claim) + { + World world = claim.getLesserBoundaryCorner().getWorld(); + + // Shouldn't be possible, but we'll leave malformed claims for GP to handle. + if (world == null) return Long.MAX_VALUE; + + final Map.Entry areaProtection = areaProtectionDuration.get(world.getName()).floorEntry(claim.getArea()); + + return areaProtection != null ? areaProtection.getValue() : Long.MAX_VALUE; + } + + /** + * Check whether a player is exempt from expiration. + * + * @param player the OfflinePlayer to check + * @return true if the player is exempt from expiration + */ + public boolean isExempt(@NotNull OfflinePlayer player) + { + if (player.isOnline()) return true; + + PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()); + + // TODO: per-world + if (exceedsConfigInt("expiration.bypass.claim_blocks", playerData::getAccruedClaimBlocks)) return true; + + // TODO: per-world + if (exceedsConfigInt("expiration.bypass.bonus_claim_blocks", playerData::getBonusClaimBlocks)) return true; + + // TODO: per-world + return plugin.getConfig().getStringList("expiration.bypass.permissions").stream() + .anyMatch(permission -> plugin.getPermissionBridge().hasPermission(player, permission)); + } + + private boolean exceedsConfigInt(@NotNull String path, @NotNull Supplier integerSupplier) + { + int configValue = plugin.getConfig().getInt(path, -1); + + if (configValue < 0) return false; + + return configValue <= integerSupplier.get(); + } + + public @NotNull List getCommandList(@NotNull String key, MessageReplacement @NotNull ... replacements) + { + // TODO: per-world + List list = plugin.getConfig().getStringList(key); + + if (list.isEmpty()) return list; + + return list.stream().map(command -> { + for (MessageReplacement replacement : replacements) { + command = replacement.replace(command); + } + return command; + }).collect(Collectors.toList()); + } + +} diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/config/TreeMapSetting.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/TreeMapSetting.java new file mode 100644 index 0000000..665d7d9 --- /dev/null +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/TreeMapSetting.java @@ -0,0 +1,64 @@ +package com.github.gpaddons.gpclaimexpiration.config; + +import com.github.jikoo.planarwrappers.config.ParsedComplexSetting; +import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +public abstract class TreeMapSetting, V> extends ParsedComplexSetting> +{ + + protected TreeMapSetting(@NotNull ConfigurationSection section, + @NotNull String path, @NotNull TreeMap defaultValue) + { + super(section, path, Collections.unmodifiableNavigableMap(defaultValue)); + } + + @Override + protected @Nullable NavigableMap convert( + @Nullable ConfigurationSection value) + { + TreeMap map = new TreeMap<>(); + + if (value == null) { + return map; + } + + for (String section1Key : value.getKeys(true)) { + K convertedKey = convertKey(section1Key); + if (convertedKey == null || !value.isList(section1Key)) { + continue; + } + + for (String rawValue : value.getStringList(section1Key)) { + V convertedValue = convertValue(rawValue); + if (convertedValue != null) { + map.put(convertedKey, convertedValue); + } + } + } + + return Collections.unmodifiableNavigableMap(map); + } + + /** + * Convert a {@link String} into a usable key. + * + * @param key the key in {@code String} form + * @return the key or {@code null} if the key cannot be parsed + */ + protected abstract @Nullable K convertKey(@NotNull String key); + + /** + * Convert a {@link String} into a usable value. + * + * @param value the value in {@code String} form + * @return the value or {@code null} if the value cannot be parsed + */ + protected abstract @Nullable V convertValue(@NotNull String value); + +} diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java index a4065e0..8c72390 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java @@ -47,13 +47,13 @@ void warn(@NotNull Claim claim, @Nullable CommandSender modifier) OfflinePlayer player = plugin.getServer().getOfflinePlayer(claim.ownerID); - long protectionDuration = plugin.getProtectionDuration(claim); + long protectionDuration = plugin.config().getProtectionDuration(claim); // Ensure claim is of a size that will actually expire. if (protectionDuration == Long.MAX_VALUE) return; // Ensure claim will be eligible for delete. - if (plugin.isExempt(player)) return; + if (plugin.config().isExempt(player)) return; long days = TimeUnit.DAYS.convert(protectionDuration, TimeUnit.MILLISECONDS); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a55d758..cfb9b63 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -21,3 +21,25 @@ expiration: pet: days: 60 commands: [] + +# Per-world overrides +# Note that only certain values are configurable per-world. +overrides: + # Ex.: A high turnover world may have + high_turnover_world: + expiration: + days-per-area: + 250000: -1 + 10000: 7 + 0: 2 + pet: + days: 7 + # Ex.: The commercial hub requires activity to keep store location, no one is allowed to bypass expiration. + commercial_hub_world: + expiration: + bypass: + claim_blocks: -1 + bonus_claim_blocks: -1 + permissions: [] + claim.commands: + - adminclaimauction $world $locX $locZ $locXMax $locZMax $area From 471e57647a47b6ee40062cd97c21d49df63490de Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 14 Apr 2024 12:29:51 -0400 Subject: [PATCH 2/4] Migrate to shared Actions --- .github/workflows/auto-merge-dependabot.yml | 34 ++++++--------------- .github/workflows/build.yml | 30 ------------------ .github/workflows/ci.yml | 10 ++++++ .github/workflows/pull_request.yml | 13 ++++++++ jitpack.yml | 3 ++ 5 files changed, 36 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 jitpack.yml diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index a47f73a..ba6410d 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -1,29 +1,15 @@ name: Auto-merge Dependabot PRs on: - pull_request_target + workflow_run: + workflows: [ "Pull Request" ] + types: [ completed ] jobs: - auto-approve: - runs-on: ubuntu-latest - steps: - - name: Wait for build success - uses: fountainhead/action-wait-for-check@v1.0.0 - id: wait-for-build - if: github.actor == 'dependabot[bot]' - with: - token: ${{ secrets.GITHUB_TOKEN }} - checkName: build - ref: ${{ github.event.pull_request.head.sha || github.sha }} - - name: autoapprove - if: github.actor == 'dependabot[bot]' && steps.wait-for-build.outputs.conclusion == 'success' - uses: hmarr/auto-approve-action@v2.0.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: automerge - if: github.actor == 'dependabot[bot]' && steps.wait-for-build.outputs.conclusion == 'success' - uses: "pascalgn/automerge-action@v0.12.0" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: "dependencies" - MERGE_METHOD: "squash" + automerge-dependabot-pr: + if: "github.actor == 'dependabot[bot]' + && github.event.workflow_run.event == 'pull_request' + && github.event.workflow_run.conclusion == 'success'" + uses: Jikoo/PlanarActions/.github/workflows/pr_automerge_complete.yml@master + with: + triggering-workflow-run: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b617642..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build - -on: - push: - create: - types: [tag] - pull_request_target: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Java - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '17' - - - name: Cache Maven repo - uses: actions/cache@v2 - id: cache - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - - - name: Build with Maven - run: mvn clean package --file pom.xml -X -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c092278 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,10 @@ +name: Build + +on: + push: + branches-ignore: + - dependabot/** + +jobs: + run-ci: + uses: Jikoo/PlanarActions/.github/workflows/ci_maven.yml@master diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..236f785 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,13 @@ +name: Pull Request + +on: + pull_request: + +jobs: + run-ci: + uses: Jikoo/PlanarActions/.github/workflows/ci_maven.yml@master + store-dependabot-pr-data: + if: "github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'" + uses: Jikoo/PlanarActions/.github/workflows/pr_automerge_prep.yml@master + with: + pr-number: ${{ github.event.number }} diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..792284e --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: + - sdk install java 17.0.10-tem + - sdk use java 17.0.10-tem From f22246040934abc5477d316997601499cf078420 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 14 Apr 2024 13:51:11 -0400 Subject: [PATCH 3/4] Add per-world support for remaining settings --- pom.xml | 17 +-- .../gpclaimexpiration/EvaluationManager.java | 23 ++-- .../gpclaimexpiration/GPClaimExpiration.java | 9 +- .../UnprotectedPetAbandoner.java | 23 ++-- .../config/Configuration.java | 78 ++++++++--- .../config/StringListSetting.java | 34 +++++ .../listener/WarningListener.java | 4 +- .../com/github/gpaddons/util/VaultBridge.java | 127 ------------------ .../lang/replacement/OwnerReplacement.java | 12 +- src/main/resources/config.yml | 2 +- 10 files changed, 137 insertions(+), 192 deletions(-) create mode 100644 src/main/java/com/github/gpaddons/gpclaimexpiration/config/StringListSetting.java delete mode 100644 src/main/java/com/github/gpaddons/util/VaultBridge.java diff --git a/pom.xml b/pom.xml index 669affb..fa74fb7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,9 @@ 1.16 + 17 + 17 + UTF-8 @@ -50,16 +53,10 @@ 3562a238dd provided - - com.github.MilkBowl - VaultAPI - 1.7.1 - provided - com.github.jikoo planarwrappers - 2.2.4 + 3.2.0 compile @@ -83,15 +80,11 @@ org.apache.maven.plugins maven-compiler-plugin 3.8.1 - - 8 - 8 - org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.5.2 package diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java index 692c651..99831cb 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/EvaluationManager.java @@ -6,6 +6,7 @@ import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent; import org.bukkit.OfflinePlayer; +import org.bukkit.World; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; @@ -98,12 +99,6 @@ private void checkNextPlayer() OfflinePlayer player = plugin.getServer().getOfflinePlayer(playerUUID); - // Ensure player is not exempt from claim expiration. - if (plugin.config().isExempt(player)) return; - - GriefPrevention.AddLogEntry(String.format("[GPClaimExpiration] %s is not exempt from expiration.", - playerUUID), CustomLogEntryTypes.Debug, true); - long timeSinceLastSession = System.currentTimeMillis() - plugin.getLastQualifyingSession(player); // Ensure last qualifying session is before the earliest time any claim could expire. @@ -127,7 +122,7 @@ private void evaluateClaims(@NotNull OfflinePlayer player, long timeSinceLastSes try { - playerClaims.get().forEach(claim -> evaluateClaim(claim, timeSinceLastSession)); + playerClaims.get().forEach(claim -> evaluateClaim(player, claim, timeSinceLastSession)); } catch (CancellationException ignored) { @@ -139,13 +134,23 @@ private void evaluateClaims(@NotNull OfflinePlayer player, long timeSinceLastSes } } - private void evaluateClaim(@NotNull Claim claim, long timeSinceLastSession) + private void evaluateClaim(@NotNull OfflinePlayer player, @NotNull Claim claim, long timeSinceLastSession) { if (timeSinceLastSession <= plugin.config().getProtectionDuration(claim)) return; GriefPrevention.AddLogEntry(String.format("[GPClaimExpiration] %s has an area of %s and is eligible for delete", claim.getID(), claim.getArea()), CustomLogEntryTypes.Debug, true); + // Ensure player is not exempt from claim expiration. + World world = claim.getLesserBoundaryCorner().getWorld(); + String worldName = world == null ? "///illegal world name\\\\\\" : world.getName(); + if (plugin.config().isExempt(player, worldName)) return; + + GriefPrevention.AddLogEntry( + String.format("[GPClaimExpiration] %s is not exempt from expiration.", player.getUniqueId()), + CustomLogEntryTypes.Debug, + true); + // Don't attempt to schedule if plugin is disabled. if (!plugin.isEnabled()) return; @@ -162,7 +167,7 @@ private void evaluateClaim(@NotNull Claim claim, long timeSinceLastSession) claim.getID(), claim.ownerID), CustomLogEntryTypes.Debug, false); // Fetch delete commands. - List commandList = plugin.config().getCommandList("expiration.claim.commands", new ClaimReplacement(claim)); + List commandList = plugin.config().getClaimCommandList(worldName, new ClaimReplacement(claim)); // Delete claim. GriefPrevention.instance.dataStore.deleteClaim(claim, true); diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java index a53c979..643815b 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/GPClaimExpiration.java @@ -4,8 +4,8 @@ import com.github.gpaddons.gpclaimexpiration.lang.Message; import com.github.gpaddons.gpclaimexpiration.listener.LegacyWarningListener; import com.github.gpaddons.gpclaimexpiration.listener.ModernWarningListener; -import com.github.gpaddons.util.VaultBridge; import com.github.gpaddons.util.lang.Lang; +import com.github.jikoo.planarwrappers.service.VaultPermission; import org.bukkit.OfflinePlayer; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; @@ -17,7 +17,7 @@ public class GPClaimExpiration extends JavaPlugin { - private final VaultBridge vault = new VaultBridge(this); + private VaultPermission vault; private Configuration config; @Override @@ -31,8 +31,9 @@ public void onEnable() // Unregister existing listeners. HandlerList.unregisterAll(this); + this.vault = new VaultPermission(this); + // Register listeners. - getServer().getPluginManager().registerEvents(vault, this); getServer().getPluginManager().registerEvents(new UnprotectedPetAbandoner(this), this); // Only bother with warning listener if message is set. @@ -75,7 +76,7 @@ public long getLastQualifyingSession(@NotNull OfflinePlayer player) return config; } - public VaultBridge getPermissionBridge() + public VaultPermission getPermissionBridge() { return vault; } diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java index e781011..7006faf 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/UnprotectedPetAbandoner.java @@ -48,10 +48,9 @@ private void onPlayerInteractEntity(@NotNull EntityDamageEvent event) Entity damager = ((EntityDamageByEntityEvent) event).getDamager(); if (damager instanceof Player) player = (Player) damager; - else if (damager instanceof Projectile) + else if (damager instanceof Projectile projectile) { - Projectile projectile = (Projectile) damager; - if (projectile.getShooter() instanceof Player) + if (projectile.getShooter() instanceof Player) player = (Player) projectile.getShooter(); } } @@ -69,18 +68,20 @@ private void onPlayerInteractEntity(@NotNull PlayerInteractEntityEvent event) private void onPetInteract(@Nullable Player actor, @NotNull Entity entity) { - int days = plugin.getConfig().getInt("expiration.pets.days", -1); + // Ensure entity is a pet. + if (!(entity instanceof Tameable tameable)) return; - // Ensure expiration on unclaimed pets is set and entity is a pet. - if (days < 0 || !(entity instanceof Tameable)) return; + String world = entity.getWorld().getName(); + int days = plugin.config().getPetProtectionDuration(world); + + // Ensure expiration on unclaimed pets is set. + if (days < 0) return; - Tameable tameable = (Tameable) entity; final AnimalTamer animalTamer = tameable.getOwner(); // Ensure pet is tamed. - if (!(animalTamer instanceof OfflinePlayer)) return; + if (!(animalTamer instanceof OfflinePlayer owner)) return; - OfflinePlayer owner = (OfflinePlayer) animalTamer; Claim claim = getClaim(tameable.getLocation(), actor); // Treat admin claims as unclaimed area - no owner to transfer to. @@ -90,7 +91,7 @@ private void onPetInteract(@Nullable Player actor, @NotNull Entity entity) if (claim != null && claim.getPermission(owner.getUniqueId().toString()) != null) return; // Ensure pet owner is not exempt from expiration. - if (plugin.config().isExempt(owner)) return; + if (plugin.config().isExempt(owner, world)) return; // Ensure pet owner's last play session was long enough ago to expire pet ownership. if (plugin.getLastQualifyingSession(owner) >= System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS)) return; @@ -132,7 +133,7 @@ private void onPetInteract(@Nullable Player actor, @NotNull Entity entity) } // Run pet abandonment commands. - for (String command : plugin.config().getCommandList("expiration.pets.commands", + for (String command : plugin.config().getPetCommandList(world, new OwnerReplacement(owner), new LocationReplacement(tameable.getLocation()))) { plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command); diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java index 9bb91b2..db0cc0e 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/Configuration.java @@ -3,6 +3,8 @@ import com.github.gpaddons.gpclaimexpiration.GPClaimExpiration; import com.github.gpaddons.util.lang.MessageReplacement; import com.github.jikoo.planarwrappers.config.Setting; +import com.github.jikoo.planarwrappers.config.SimpleSetSetting; +import com.github.jikoo.planarwrappers.config.impl.IntSetting; import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.PlayerData; @@ -15,16 +17,22 @@ import java.util.Map; import java.util.NavigableMap; import java.util.Optional; +import java.util.Set; import java.util.TreeMap; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import java.util.stream.Collectors; public class Configuration { private final GPClaimExpiration plugin; private final Setting> areaProtectionDuration; + private final Setting exemptionClaimBlocks; + private final Setting exemptionBonusClaimBlocks; + private final Setting> exemptionPermissions; + private final Setting> claimExpirationCommands; + private final Setting petProtectionDuration; + private final Setting> petExpirationCommands; public Configuration(GPClaimExpiration plugin) { @@ -37,7 +45,7 @@ public Configuration(GPClaimExpiration plugin) defaults.put(1_000, TimeUnit.MILLISECONDS.convert(60, TimeUnit.DAYS)); defaults.put(0, 0L); - areaProtectionDuration = new TreeMapSetting(plugin.getConfig(), "expiration.days_per_area", defaults) + areaProtectionDuration = new TreeMapSetting<>(plugin.getConfig(), "expiration.days_per_area", defaults) { @Override protected @Nullable Integer convertKey(@NotNull String key) @@ -71,6 +79,20 @@ public Configuration(GPClaimExpiration plugin) } } }; + + exemptionClaimBlocks = new IntSetting(plugin.getConfig(), "expiration.bypass.claim_blocks", -1); + exemptionBonusClaimBlocks = new IntSetting(plugin.getConfig(), "expiration.bypass.bonus_claim_blocks", -1); + exemptionPermissions = new SimpleSetSetting<>(plugin.getConfig(), "expiration.bypass.permissions", Set.of("gpclaimexpiration.persist")) { + @Override + protected @NotNull String convertValue(@NotNull String value) + { + return value; + } + }; + claimExpirationCommands = new StringListSetting(plugin.getConfig(), "expiration.claim.commands", List.of()); + + petProtectionDuration = new IntSetting(plugin.getConfig(), "expiration.pets.days", 60); + petExpirationCommands = new StringListSetting(plugin.getConfig(), "expiration.pet.commands", List.of()); } /** @@ -122,38 +144,43 @@ public long getProtectionDuration(@NotNull Claim claim) * Check whether a player is exempt from expiration. * * @param player the OfflinePlayer to check + * @param worldName the name of the world * @return true if the player is exempt from expiration */ - public boolean isExempt(@NotNull OfflinePlayer player) + public boolean isExempt(@NotNull OfflinePlayer player, @NotNull String worldName) { if (player.isOnline()) return true; PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()); - // TODO: per-world - if (exceedsConfigInt("expiration.bypass.claim_blocks", playerData::getAccruedClaimBlocks)) return true; + if (exceedsInt(exemptionClaimBlocks.get(worldName), playerData::getAccruedClaimBlocks)) return true; - // TODO: per-world - if (exceedsConfigInt("expiration.bypass.bonus_claim_blocks", playerData::getBonusClaimBlocks)) return true; + if (exceedsInt(exemptionBonusClaimBlocks.get(worldName), playerData::getBonusClaimBlocks)) return true; - // TODO: per-world - return plugin.getConfig().getStringList("expiration.bypass.permissions").stream() - .anyMatch(permission -> plugin.getPermissionBridge().hasPermission(player, permission)); + return exemptionPermissions.get(worldName).stream() + .anyMatch(permission -> plugin.getPermissionBridge().hasPermission(player, permission, worldName)); } - private boolean exceedsConfigInt(@NotNull String path, @NotNull Supplier integerSupplier) + private boolean exceedsInt(int configValue, @NotNull Supplier integerSupplier) { - int configValue = plugin.getConfig().getInt(path, -1); - if (configValue < 0) return false; return configValue <= integerSupplier.get(); } - public @NotNull List getCommandList(@NotNull String key, MessageReplacement @NotNull ... replacements) + public @NotNull List getClaimCommandList( + @NotNull String worldName, + MessageReplacement @NotNull ... replacements) + { + return getCommandList(claimExpirationCommands, worldName, replacements); + } + + protected @NotNull List getCommandList( + @NotNull Setting> commands, + @NotNull String worldName, + MessageReplacement @NotNull ... replacements) { - // TODO: per-world - List list = plugin.getConfig().getStringList(key); + List list = commands.get(worldName); if (list.isEmpty()) return list; @@ -162,7 +189,24 @@ private boolean exceedsConfigInt(@NotNull String path, @NotNull Supplier getPetCommandList( + @NotNull String worldName, + MessageReplacement @NotNull ... replacements) + { + return getCommandList(petExpirationCommands, worldName, replacements); } } diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/config/StringListSetting.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/StringListSetting.java new file mode 100644 index 0000000..8dce379 --- /dev/null +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/config/StringListSetting.java @@ -0,0 +1,34 @@ +package com.github.gpaddons.gpclaimexpiration.config; + +import com.github.jikoo.planarwrappers.config.ParsedSetting; +import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +public class StringListSetting extends ParsedSetting> +{ + + protected StringListSetting( + @NotNull ConfigurationSection section, + @NotNull String path, + @NotNull List defaultValue) + { + super(section, path, defaultValue); + } + + @Override + protected boolean test(@NotNull String path) + { + return section.isList(path); + } + + @Override + protected @Nullable List convert(@NotNull String path) + { + return Collections.unmodifiableList(section.getStringList(path)); + } + +} diff --git a/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java b/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java index 8c72390..9bdd2d3 100644 --- a/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java +++ b/src/main/java/com/github/gpaddons/gpclaimexpiration/listener/WarningListener.java @@ -37,7 +37,7 @@ void warn(@NotNull Claim claim, @Nullable UUID modifier) void warn(@NotNull Claim claim, @Nullable CommandSender modifier) { // Ensure modification is by a player. - if (!(modifier instanceof Player)) return; + if (!(modifier instanceof Player playerModifier)) return; // Ensure message is set. if (!Lang.isSet(Message.NOTIFICATION_EXPIRATION)) return; @@ -53,7 +53,7 @@ void warn(@NotNull Claim claim, @Nullable CommandSender modifier) if (protectionDuration == Long.MAX_VALUE) return; // Ensure claim will be eligible for delete. - if (plugin.config().isExempt(player)) return; + if (plugin.config().isExempt(player, playerModifier.getWorld().getName())) return; long days = TimeUnit.DAYS.convert(protectionDuration, TimeUnit.MILLISECONDS); diff --git a/src/main/java/com/github/gpaddons/util/VaultBridge.java b/src/main/java/com/github/gpaddons/util/VaultBridge.java deleted file mode 100644 index e344fa6..0000000 --- a/src/main/java/com/github/gpaddons/util/VaultBridge.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.github.gpaddons.util; - -import com.github.gpaddons.gpclaimexpiration.GPClaimExpiration; -import me.ryanhamshire.GriefPrevention.GriefPrevention; -import net.milkbowl.vault.permission.Permission; -import org.bukkit.OfflinePlayer; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.event.server.PluginEnableEvent; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * A bridge for Vault-supporting permissions plugins. - */ -public class VaultBridge implements Listener -{ - - private final @NotNull GPClaimExpiration plugin; - private boolean setupDone = false; - private @Nullable PermissionWrapper permissionWrapper = null; - - public VaultBridge(@NotNull GPClaimExpiration plugin) - { - this.plugin = plugin; - } - - /** - * Check if a player is granted a permission. - * - * @param player the OfflinePlayer to check permissions for - * @param permission the permission to check - * @return true if the player has the permission - */ - public boolean hasPermission(@NotNull OfflinePlayer player, @NotNull String permission) - { - loadPermission(false); - - if (this.permissionWrapper == null) return false; - - return this.permissionWrapper.getPermission().playerHas(null, player, permission); - } - - @EventHandler - private void onPluginEnable(@NotNull PluginEnableEvent event) - { - loadPermission(true); - } - - @EventHandler - private void onPluginDisable(@NotNull PluginDisableEvent event) - { - loadPermission(true); - } - - private void loadPermission(boolean setupState) - { - // If no change is likely, have we already obtained the Permission? - if (setupState != setupDone) return; - - // Are any bypass permissions configured? - if (plugin.getConfig().getStringList("expiration.bypass.permissions").isEmpty()) - { - finishSetup(false, null); - return; - } - - // Ensure Vault present. - try - { - Class.forName("net.milkbowl.vault.permission.Permission"); - } - catch (ClassNotFoundException e) - { - finishSetup(false, "[GPClaimExpiration] ERROR: Vault is required for permission integration."); - return; - } - - RegisteredServiceProvider registration = plugin.getServer().getServicesManager().getRegistration(Permission.class); - - // Ensure a Permission is available. - if (registration == null) - { - finishSetup(false, "[GPClaimExpiration] ERROR: Vault was unable to find a supported permissions plugin. It should default to Bukkit's SuperPerms system."); - return; - } - - Permission newPermission = registration.getProvider(); - - // If Permission hasn't changed, do nothing. - if (permissionWrapper != null && permissionWrapper.getPermission().equals(newPermission)) return; - - // Set setupDone false to force log line for changing Permission. - setupDone = false; - permissionWrapper = new PermissionWrapper(newPermission); - - finishSetup(true, "[GPClaimExpiration] Hooked into permissions system: " + permissionWrapper.getPermission().getName() + ". Ready to check offline permissions!"); - } - - private void finishSetup(boolean ready, @Nullable String log) { - if (!ready) this.permissionWrapper = null; - - if (log != null && !setupDone) GriefPrevention.AddLogEntry(log); - - this.setupDone = true; - } - - private static class PermissionWrapper - { - - private final @NotNull Permission permission; - - private PermissionWrapper(@NotNull Permission permission) - { - this.permission = permission; - } - - @NotNull Permission getPermission() - { - return this.permission; - } - - } - -} diff --git a/src/main/java/com/github/gpaddons/util/lang/replacement/OwnerReplacement.java b/src/main/java/com/github/gpaddons/util/lang/replacement/OwnerReplacement.java index f7c6665..87a70b7 100644 --- a/src/main/java/com/github/gpaddons/util/lang/replacement/OwnerReplacement.java +++ b/src/main/java/com/github/gpaddons/util/lang/replacement/OwnerReplacement.java @@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Objects; import java.util.UUID; /** @@ -54,14 +55,7 @@ private OwnerReplacement(@NotNull String prefix, @Nullable UUID uuid, @Nullable this.replaceId = '$' + prefix + "Id"; this.replaceName = '$' + prefix + "Name"; - if (uuid == null) - { - this.uuidVal = new UUID(0, 0).toString(); - } - else - { - this.uuidVal = uuid.toString(); - } + this.uuidVal = Objects.requireNonNullElseGet(uuid, () -> new UUID(0, 0)).toString(); if (player == null) { @@ -69,7 +63,7 @@ private OwnerReplacement(@NotNull String prefix, @Nullable UUID uuid, @Nullable } else { - nameVal = Lang.getName(player); + this.nameVal = Lang.getName(player); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index cfb9b63..3c19665 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -25,7 +25,7 @@ expiration: # Per-world overrides # Note that only certain values are configurable per-world. overrides: - # Ex.: A high turnover world may have + # Ex.: A high turnover world may have higher activity requirements. high_turnover_world: expiration: days-per-area: From 5c6e917e43c14b0b3d18201cd5d93e85f62d6a9a Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 14 Apr 2024 13:51:26 -0400 Subject: [PATCH 4/4] Clean up nags --- .editorconfig | 250 -------------------------------------------------- .gitignore | 1 + 2 files changed, 1 insertion(+), 250 deletions(-) diff --git a/.editorconfig b/.editorconfig index e3c6018..fddee2b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -257,253 +257,3 @@ ij_editorconfig_space_after_comma = true ij_editorconfig_space_before_colon = false ij_editorconfig_space_before_comma = false ij_editorconfig_spaces_around_assignment_operators = true - -[{*.ant, *.fxml, *.jhm, *.jnlp, *.jrxml, *.jspx, *.pom, *.rng, *.tagx, *.tld, *.wsdl, *.xml, *.xsd, *.xsl, *.xslt, *.xul}] -ij_xml_align_attributes = true -ij_xml_align_text = false -ij_xml_attribute_wrap = normal -ij_xml_block_comment_at_first_column = true -ij_xml_keep_blank_lines = 2 -ij_xml_keep_indents_on_empty_lines = false -ij_xml_keep_line_breaks = true -ij_xml_keep_line_breaks_in_text = true -ij_xml_keep_whitespaces = false -ij_xml_keep_whitespaces_around_cdata = preserve -ij_xml_keep_whitespaces_inside_cdata = false -ij_xml_line_comment_at_first_column = true -ij_xml_space_after_tag_name = false -ij_xml_space_around_equals_in_attribute = false -ij_xml_space_inside_empty_tag = false -ij_xml_text_wrap = normal - -[{*.bash, *.sh, *.zsh}] -indent_size = 2 -tab_width = 2 -ij_shell_binary_ops_start_line = false -ij_shell_keep_column_alignment_padding = false -ij_shell_minify_program = false -ij_shell_redirect_followed_by_space = false -ij_shell_switch_cases_indented = false - -[{*.gant, *.gradle, *.groovy, *.gy}] -ij_groovy_align_group_field_declarations = false -ij_groovy_align_multiline_array_initializer_expression = false -ij_groovy_align_multiline_assignment = false -ij_groovy_align_multiline_binary_operation = false -ij_groovy_align_multiline_chained_methods = false -ij_groovy_align_multiline_extends_list = false -ij_groovy_align_multiline_for = true -ij_groovy_align_multiline_list_or_map = true -ij_groovy_align_multiline_method_parentheses = false -ij_groovy_align_multiline_parameters = true -ij_groovy_align_multiline_parameters_in_calls = false -ij_groovy_align_multiline_resources = true -ij_groovy_align_multiline_ternary_operation = false -ij_groovy_align_multiline_throws_list = false -ij_groovy_align_named_args_in_map = true -ij_groovy_align_throws_keyword = false -ij_groovy_array_initializer_new_line_after_left_brace = false -ij_groovy_array_initializer_right_brace_on_new_line = false -ij_groovy_array_initializer_wrap = off -ij_groovy_assert_statement_wrap = off -ij_groovy_assignment_wrap = off -ij_groovy_binary_operation_wrap = off -ij_groovy_blank_lines_after_class_header = 0 -ij_groovy_blank_lines_after_imports = 1 -ij_groovy_blank_lines_after_package = 1 -ij_groovy_blank_lines_around_class = 1 -ij_groovy_blank_lines_around_field = 0 -ij_groovy_blank_lines_around_field_in_interface = 0 -ij_groovy_blank_lines_around_method = 1 -ij_groovy_blank_lines_around_method_in_interface = 1 -ij_groovy_blank_lines_before_imports = 1 -ij_groovy_blank_lines_before_method_body = 0 -ij_groovy_blank_lines_before_package = 0 -ij_groovy_block_brace_style = end_of_line -ij_groovy_block_comment_at_first_column = true -ij_groovy_call_parameters_new_line_after_left_paren = false -ij_groovy_call_parameters_right_paren_on_new_line = false -ij_groovy_call_parameters_wrap = off -ij_groovy_catch_on_new_line = false -ij_groovy_class_annotation_wrap = split_into_lines -ij_groovy_class_brace_style = end_of_line -ij_groovy_class_count_to_use_import_on_demand = 5 -ij_groovy_do_while_brace_force = never -ij_groovy_else_on_new_line = false -ij_groovy_enum_constants_wrap = off -ij_groovy_extends_keyword_wrap = off -ij_groovy_extends_list_wrap = off -ij_groovy_field_annotation_wrap = split_into_lines -ij_groovy_finally_on_new_line = false -ij_groovy_for_brace_force = never -ij_groovy_for_statement_new_line_after_left_paren = false -ij_groovy_for_statement_right_paren_on_new_line = false -ij_groovy_for_statement_wrap = off -ij_groovy_if_brace_force = never -ij_groovy_import_annotation_wrap = 2 -ij_groovy_indent_case_from_switch = true -ij_groovy_indent_label_blocks = true -ij_groovy_insert_inner_class_imports = false -ij_groovy_keep_blank_lines_before_right_brace = 2 -ij_groovy_keep_blank_lines_in_code = 2 -ij_groovy_keep_blank_lines_in_declarations = 2 -ij_groovy_keep_control_statement_in_one_line = true -ij_groovy_keep_first_column_comment = true -ij_groovy_keep_indents_on_empty_lines = false -ij_groovy_keep_line_breaks = true -ij_groovy_keep_multiple_expressions_in_one_line = false -ij_groovy_keep_simple_blocks_in_one_line = false -ij_groovy_keep_simple_classes_in_one_line = true -ij_groovy_keep_simple_lambdas_in_one_line = true -ij_groovy_keep_simple_methods_in_one_line = true -ij_groovy_label_indent_absolute = false -ij_groovy_label_indent_size = 0 -ij_groovy_lambda_brace_style = end_of_line -ij_groovy_layout_static_imports_separately = true -ij_groovy_line_comment_add_space = false -ij_groovy_line_comment_at_first_column = true -ij_groovy_method_annotation_wrap = split_into_lines -ij_groovy_method_brace_style = end_of_line -ij_groovy_method_call_chain_wrap = off -ij_groovy_method_parameters_new_line_after_left_paren = false -ij_groovy_method_parameters_right_paren_on_new_line = false -ij_groovy_method_parameters_wrap = off -ij_groovy_modifier_list_wrap = false -ij_groovy_names_count_to_use_import_on_demand = 3 -ij_groovy_parameter_annotation_wrap = off -ij_groovy_parentheses_expression_new_line_after_left_paren = false -ij_groovy_parentheses_expression_right_paren_on_new_line = false -ij_groovy_prefer_parameters_wrap = false -ij_groovy_resource_list_new_line_after_left_paren = false -ij_groovy_resource_list_right_paren_on_new_line = false -ij_groovy_resource_list_wrap = off -ij_groovy_space_after_assert_separator = true -ij_groovy_space_after_colon = true -ij_groovy_space_after_comma = true -ij_groovy_space_after_comma_in_type_arguments = true -ij_groovy_space_after_for_semicolon = true -ij_groovy_space_after_quest = true -ij_groovy_space_after_type_cast = true -ij_groovy_space_before_annotation_parameter_list = false -ij_groovy_space_before_array_initializer_left_brace = false -ij_groovy_space_before_assert_separator = false -ij_groovy_space_before_catch_keyword = true -ij_groovy_space_before_catch_left_brace = true -ij_groovy_space_before_catch_parentheses = true -ij_groovy_space_before_class_left_brace = true -ij_groovy_space_before_closure_left_brace = true -ij_groovy_space_before_colon = true -ij_groovy_space_before_comma = false -ij_groovy_space_before_do_left_brace = true -ij_groovy_space_before_else_keyword = true -ij_groovy_space_before_else_left_brace = true -ij_groovy_space_before_finally_keyword = true -ij_groovy_space_before_finally_left_brace = true -ij_groovy_space_before_for_left_brace = true -ij_groovy_space_before_for_parentheses = true -ij_groovy_space_before_for_semicolon = false -ij_groovy_space_before_if_left_brace = true -ij_groovy_space_before_if_parentheses = true -ij_groovy_space_before_method_call_parentheses = false -ij_groovy_space_before_method_left_brace = true -ij_groovy_space_before_method_parentheses = false -ij_groovy_space_before_quest = true -ij_groovy_space_before_switch_left_brace = true -ij_groovy_space_before_switch_parentheses = true -ij_groovy_space_before_synchronized_left_brace = true -ij_groovy_space_before_synchronized_parentheses = true -ij_groovy_space_before_try_left_brace = true -ij_groovy_space_before_try_parentheses = true -ij_groovy_space_before_while_keyword = true -ij_groovy_space_before_while_left_brace = true -ij_groovy_space_before_while_parentheses = true -ij_groovy_space_in_named_argument = true -ij_groovy_space_in_named_argument_before_colon = false -ij_groovy_space_within_empty_array_initializer_braces = false -ij_groovy_space_within_empty_method_call_parentheses = false -ij_groovy_spaces_around_additive_operators = true -ij_groovy_spaces_around_assignment_operators = true -ij_groovy_spaces_around_bitwise_operators = true -ij_groovy_spaces_around_equality_operators = true -ij_groovy_spaces_around_lambda_arrow = true -ij_groovy_spaces_around_logical_operators = true -ij_groovy_spaces_around_multiplicative_operators = true -ij_groovy_spaces_around_regex_operators = true -ij_groovy_spaces_around_relational_operators = true -ij_groovy_spaces_around_shift_operators = true -ij_groovy_spaces_within_annotation_parentheses = false -ij_groovy_spaces_within_array_initializer_braces = false -ij_groovy_spaces_within_braces = true -ij_groovy_spaces_within_brackets = false -ij_groovy_spaces_within_cast_parentheses = false -ij_groovy_spaces_within_catch_parentheses = false -ij_groovy_spaces_within_for_parentheses = false -ij_groovy_spaces_within_gstring_injection_braces = false -ij_groovy_spaces_within_if_parentheses = false -ij_groovy_spaces_within_list_or_map = false -ij_groovy_spaces_within_method_call_parentheses = false -ij_groovy_spaces_within_method_parentheses = false -ij_groovy_spaces_within_parentheses = false -ij_groovy_spaces_within_switch_parentheses = false -ij_groovy_spaces_within_synchronized_parentheses = false -ij_groovy_spaces_within_try_parentheses = false -ij_groovy_spaces_within_tuple_expression = false -ij_groovy_spaces_within_while_parentheses = false -ij_groovy_special_else_if_treatment = true -ij_groovy_ternary_operation_wrap = off -ij_groovy_throws_keyword_wrap = off -ij_groovy_throws_list_wrap = off -ij_groovy_use_flying_geese_braces = false -ij_groovy_use_fq_class_names = false -ij_groovy_use_fq_class_names_in_javadoc = true -ij_groovy_use_relative_indents = false -ij_groovy_use_single_class_imports = true -ij_groovy_variable_annotation_wrap = off -ij_groovy_while_brace_force = never -ij_groovy_while_on_new_line = false -ij_groovy_wrap_long_lines = false - -[{*.har, *.json}] -indent_size = 2 -ij_json_keep_blank_lines_in_code = 0 -ij_json_keep_indents_on_empty_lines = false -ij_json_keep_line_breaks = true -ij_json_space_after_colon = true -ij_json_space_after_comma = true -ij_json_space_before_colon = true -ij_json_space_before_comma = false -ij_json_spaces_within_braces = false -ij_json_spaces_within_brackets = false -ij_json_wrap_long_lines = false - -[{*.htm, *.html, *.sht, *.shtm, *.shtml}] -ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_at_first_column = true -ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p -ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span, pre, textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false -ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal - -[{*.yaml, *.yml}] -indent_size = 2 -ij_yaml_keep_indents_on_empty_lines = false -ij_yaml_keep_line_breaks = true diff --git a/.gitignore b/.gitignore index 314046f..feda6c1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Maven target/ **/pom.xml.versionsBackup +**/dependency-reduced-pom.xml # Eclipse .settings/