From 0558fcf5d5759867f70435a3038e78dff108726c Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 21 Jan 2023 22:27:20 +0100 Subject: [PATCH 01/27] Provide full verbosity for invalid components --- .../java/com/plotsquared/core/components/ComponentPreset.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java index 5f6a37d44..cb1e989c4 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java @@ -62,7 +62,7 @@ public class ComponentPreset implements ConfigurationSerializable { public static ComponentPreset deserialize(final @NonNull Map map) { final ClassicPlotManagerComponent classicPlotManagerComponent = ClassicPlotManagerComponent .fromString(map.getOrDefault("component", "").toString()).orElseThrow(() -> - new IllegalArgumentException("The preset needs a valid target component")); + new IllegalArgumentException("The preset in components.yml needs a valid target component, got: " + map.get("component"))); final String pattern = map.getOrDefault("pattern", "").toString(); final double cost = Double.parseDouble(map.getOrDefault("cost", "0.0").toString()); final String permission = map.getOrDefault("permission", "").toString(); From 0dd8b1053cfac7b137dc04e254dbe0582d77a6d3 Mon Sep 17 00:00:00 2001 From: Matthew Kaulfers <42121989+mkaulfers@users.noreply.github.com> Date: Sat, 21 Jan 2023 17:02:15 -0600 Subject: [PATCH 02/27] PS-3908: Cleanup deprecated methods to improve code maturity. (#3944) https://github.com/IntellectualSites/PlotSquared/issues/3908 --- .../main/java/com/plotsquared/core/command/Area.java | 11 +++++++---- .../plotsquared/core/generator/HybridPlotWorld.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index 093ca744d..5d9925f1a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -56,6 +56,7 @@ import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal3; import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.EditSessionBuilder; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; @@ -228,12 +229,14 @@ public class Area extends SubCommand { try (final ClipboardWriter clipboardWriter = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream( file))) { final BlockArrayClipboard clipboard = new BlockArrayClipboard(selectedRegion); - final EditSession editSession = WorldEdit - .getInstance() - .getEditSessionFactory() - .getEditSession(selectedRegion.getWorld(), -1); + + EditSessionBuilder editSessionBuilder = WorldEdit.getInstance().newEditSessionBuilder(); + editSessionBuilder.world(selectedRegion.getWorld()); + final EditSession editSession = editSessionBuilder.build(); + final ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, selectedRegion, clipboard, selectedRegion.getMinimumPoint()); + forwardExtentCopy.setCopyingBiomes(true); forwardExtentCopy.setCopyingEntities(true); Operations.complete(forwardExtentCopy); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 532cc691a..37a56329e 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -204,7 +204,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } Object value; try { - final boolean accessible = field.isAccessible(); + final boolean accessible = field.canAccess(field); field.setAccessible(true); value = field.get(this); field.setAccessible(accessible); From 83e274ff9f103156e47c0255c655f3ab0d38c877 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 22 Jan 2023 11:21:01 +0100 Subject: [PATCH 03/27] Revert "PS-3908: Cleanup deprecated methods to improve code maturity. (#3944)" This reverts commit 0dd8b1053cfac7b137dc04e254dbe0582d77a6d3. --- .../main/java/com/plotsquared/core/command/Area.java | 11 ++++------- .../plotsquared/core/generator/HybridPlotWorld.java | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index 5d9925f1a..093ca744d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -56,7 +56,6 @@ import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal3; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.EditSessionBuilder; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; @@ -229,14 +228,12 @@ public class Area extends SubCommand { try (final ClipboardWriter clipboardWriter = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream( file))) { final BlockArrayClipboard clipboard = new BlockArrayClipboard(selectedRegion); - - EditSessionBuilder editSessionBuilder = WorldEdit.getInstance().newEditSessionBuilder(); - editSessionBuilder.world(selectedRegion.getWorld()); - final EditSession editSession = editSessionBuilder.build(); - + final EditSession editSession = WorldEdit + .getInstance() + .getEditSessionFactory() + .getEditSession(selectedRegion.getWorld(), -1); final ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, selectedRegion, clipboard, selectedRegion.getMinimumPoint()); - forwardExtentCopy.setCopyingBiomes(true); forwardExtentCopy.setCopyingEntities(true); Operations.complete(forwardExtentCopy); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 37a56329e..532cc691a 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -204,7 +204,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } Object value; try { - final boolean accessible = field.canAccess(field); + final boolean accessible = field.isAccessible(); field.setAccessible(true); value = field.get(this); field.setAccessible(accessible); From 08800ec16daf1398c47fe191047a32764151a5f3 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 22 Jan 2023 11:26:07 +0100 Subject: [PATCH 04/27] Cleanup deperecated WorldEdit met Co-authored-by: Matthew Kaulfers <42121989+mkaulfers@users.noreply.github.com> --- Core/src/main/java/com/plotsquared/core/command/Area.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index 093ca744d..32e6d7ea6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -56,6 +56,7 @@ import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal3; import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.EditSessionBuilder; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; @@ -228,10 +229,9 @@ public class Area extends SubCommand { try (final ClipboardWriter clipboardWriter = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream( file))) { final BlockArrayClipboard clipboard = new BlockArrayClipboard(selectedRegion); - final EditSession editSession = WorldEdit - .getInstance() - .getEditSessionFactory() - .getEditSession(selectedRegion.getWorld(), -1); + EditSessionBuilder editSessionBuilder = WorldEdit.getInstance().newEditSessionBuilder(); + editSessionBuilder.world(selectedRegion.getWorld()); + final EditSession editSession = editSessionBuilder.build(); final ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, selectedRegion, clipboard, selectedRegion.getMinimumPoint()); forwardExtentCopy.setCopyingBiomes(true); From be8903128df2c1f5c8af7f37e579886c5cfb5084 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 12:28:33 +0100 Subject: [PATCH 05/27] Release 6.10.9 --- .../main/java/com/plotsquared/bukkit/player/BukkitPlayer.java | 4 ++-- .../com/plotsquared/core/plot/PlotModificationManager.java | 2 +- build.gradle.kts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 268258ead..75aeb647a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -75,7 +75,7 @@ public class BukkitPlayer extends PlotPlayer { * @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects. * This method will be made private in a future release. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "6.10.9") public BukkitPlayer( final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher, final @NonNull Player player, final @NonNull PermissionHandler permissionHandler @@ -92,7 +92,7 @@ public class BukkitPlayer extends PlotPlayer { * @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects. * This method will be made private in a future release. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "6.10.9") public BukkitPlayer( final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher, final @NonNull Player player, diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java index c170dec7e..81a2f740b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java @@ -334,7 +334,7 @@ public final class PlotModificationManager { * @param createSign whether to recreate signs * @param whenDone Task to run when unlink is complete * @return success/!cancelled - * @since TODO + * @since 6.10.9 */ public boolean unlinkPlot(final boolean createRoad, final boolean createSign, final Runnable whenDone) { if (!this.plot.isMerged()) { diff --git a/build.gradle.kts b/build.gradle.kts index 0a8df0130..bdfdc7923 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { } group = "com.plotsquared" -version = "6.10.9-SNAPSHOT" +version = "6.10.9" if (!File("$rootDir/.git").exists()) { logger.lifecycle(""" From b40383b5a4322cdb0b008c55aa98ee1c7100f238 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 12:33:51 +0100 Subject: [PATCH 06/27] Back to snapshot for development --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index bdfdc7923..3ef77914f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { } group = "com.plotsquared" -version = "6.10.9" +version = "6.10.10-SNAPSHOT" if (!File("$rootDir/.git").exists()) { logger.lifecycle(""" From 57875885000338934b39dcbc6dafda7762121b16 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 13:18:20 +0100 Subject: [PATCH 07/27] Move BukkitPlotGenerator#generateChunkData() deprecation from v7 to v6 --- .../plotsquared/bukkit/generator/BukkitPlotGenerator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 38e29ef3b..a9f0c43b0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -161,6 +161,12 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap world.setWaterAnimalSpawnLimit(limit); } + /** + * The entire method is deprecated, but kept for compatibility with <=1.16.2. + * The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point + * release. + */ + @Deprecated(forRemoval = true, since = "TODO") @Override public @NonNull ChunkData generateChunkData( @NonNull World world, @NonNull Random random, int x, int z, From 6130c3dfa51117d22e8feea90041856b61a4b825 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 13:28:05 +0100 Subject: [PATCH 08/27] Clarify 2D biome deprecation --- .../main/java/com/plotsquared/core/queue/QueueCoordinator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java index 12cafb5aa..df081ba0c 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java @@ -221,7 +221,7 @@ public abstract class QueueCoordinator { * @return success or not * @deprecated Biomes now take XYZ, see {@link #setBiome(int, int, int, BiomeType)} *
- * Scheduled for removal once we drop the support for versions not supporting 3D biomes. + * Scheduled for removal once we drop the support for versions not supporting 3D biomes, 1.18 and earlier. */ @Deprecated(forRemoval = true, since = "6.0.0") public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome); From ab357deb48d593357c8f3e3b2bf7d75493a7c3f1 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 13:40:35 +0100 Subject: [PATCH 09/27] Put more legacy web interface deprecations in place --- .../com/plotsquared/bukkit/generator/BukkitPlotGenerator.java | 2 +- .../main/java/com/plotsquared/core/util/SchematicHandler.java | 4 ++++ Core/src/main/java/com/plotsquared/core/util/WorldUtil.java | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index a9f0c43b0..fda56eaf3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -162,7 +162,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap } /** - * The entire method is deprecated, but kept for compatibility with <=1.16.2. + * The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2. * The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point * release. */ diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index f266a8114..7d2993ed2 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -491,6 +491,10 @@ public abstract class SchematicHandler { return null; } + /** + * The legacy web interface is deprecated for removal in favor of Arkitektonika. + */ + @Deprecated(forRemoval = true, since = "TODO") public List getSaves(UUID uuid) { String rawJSON; try { diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java index 9b9267bf9..1861be25b 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -252,6 +252,10 @@ public abstract class WorldUtil { */ public abstract void refreshChunk(int x, int z, String world); + /** + * The legacy web interface is deprecated for removal in favor of Arkitektonika. + */ + @Deprecated(forRemoval = true, since = "TODO") public void upload( final @NonNull Plot plot, final @Nullable UUID uuid, From ffbec24290d4fd13a5b746ece75d824ca41947de Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:35:15 +0100 Subject: [PATCH 10/27] Update dependency com.intellectualsites.bom:bom-1.18.x to v1.23 (#3948) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3ef77914f..19635d1e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,7 +74,7 @@ subprojects { } dependencies { - implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.22")) + implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.23")) } dependencies { From 0d359ade0c3a78b78f2dd368350c6f9c66056f57 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:21:35 +0100 Subject: [PATCH 11/27] Update dependency com.diffplug.spotless to v6.14.0 (#3950) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3fb14d96b..79d494352 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ http4j = "1.3" # Gradle plugins shadow = "7.1.2" grgit = "4.1.1" -spotless = "6.13.0" +spotless = "6.14.0" nexus = "1.1.0" [libraries] From d7c2ab1d169df9b062ab0db2192d9a14bc14efc4 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Tue, 31 Jan 2023 11:22:13 +0100 Subject: [PATCH 12/27] Make farmland keep its moisture (#3952) Handle MoistureChangeEvent for farm land --- .../bukkit/listener/BlockEventListener.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index 343acce06..fe58c41b7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -98,6 +98,7 @@ import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.CauldronLevelChangeEvent; import org.bukkit.event.block.EntityBlockFormEvent; import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.MoistureChangeEvent; import org.bukkit.event.block.SpongeAbsorbEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.projectiles.BlockProjectileSource; @@ -703,6 +704,28 @@ public class BlockEventListener implements Listener { } } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onMoistureChange(MoistureChangeEvent event) { + Block block = event.getBlock(); + Location location = BukkitUtil.adapt(block.getLocation()); + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getOwnedPlot(location); + if (plot == null) { + event.setCancelled(true); + return; + } + Material blockType = block.getType(); + if (blockType == Material.FARMLAND) { + if (!plot.getFlag(SoilDryFlag.class)) { + plot.debug("Soil could not dry because soil-dry = false"); + event.setCancelled(true); + } + } + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onChange(BlockFromToEvent event) { Block fromBlock = event.getBlock(); From 84567bcb009e8a8b50e3f27fbf58e75d21bc299c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:48:30 +0100 Subject: [PATCH 13/27] Update dependency com.diffplug.spotless to v6.14.1 (#3957) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 79d494352..fc02d8785 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ http4j = "1.3" # Gradle plugins shadow = "7.1.2" grgit = "4.1.1" -spotless = "6.14.0" +spotless = "6.14.1" nexus = "1.1.0" [libraries] From 5cce86d9247c9b72bf0d58676fdfce140d4f6605 Mon Sep 17 00:00:00 2001 From: ByteExceptionM Date: Thu, 9 Feb 2023 20:51:59 +0100 Subject: [PATCH 14/27] feat: Add event firing on remove road entity (#3955) * feat: Add event firing on remove road entity Signed-off-by: ByteExceptionM * chore: Add some more entity vars Signed-off-by: ByteExceptionM * chore: Rename method Signed-off-by: ByteExceptionM * chore: Code cleanup Signed-off-by: ByteExceptionM * chore: Code reformat Signed-off-by: ByteExceptionM * chore: Change iterator removal Signed-off-by: ByteExceptionM * Comply with checkstyle --------- Signed-off-by: ByteExceptionM Co-authored-by: Alexander Brandes --- .../plotsquared/bukkit/BukkitPlatform.java | 31 +++++---- .../plotsquared/core/events/EntityEvent.java | 63 +++++++++++++++++++ .../core/events/RemoveRoadEntityEvent.java | 50 +++++++++++++++ .../core/util/EventDispatcher.java | 8 +++ 4 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 Core/src/main/java/com/plotsquared/core/events/EntityEvent.java create mode 100644 Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 8055bd5cb..c82de570e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -71,6 +71,8 @@ import com.plotsquared.core.configuration.Storage; import com.plotsquared.core.configuration.caption.ChatFormatter; import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.database.DBFunc; +import com.plotsquared.core.events.RemoveRoadEntityEvent; +import com.plotsquared.core.events.Result; import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.SingleWorldGenerator; @@ -109,6 +111,7 @@ import com.plotsquared.core.uuid.CacheUUIDService; import com.plotsquared.core.uuid.UUIDPipeline; import com.plotsquared.core.uuid.offline.OfflineModeUUIDService; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import io.papermc.lib.PaperLib; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.text.Component; @@ -810,8 +813,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (entity.hasMetadata("ps-tmp-teleport")) { continue; } - iterator.remove(); - entity.remove(); + this.removeRoadEntity(entity, iterator); } continue; } @@ -824,8 +826,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (entity.hasMetadata("ps-tmp-teleport")) { continue; } - iterator.remove(); - entity.remove(); + this.removeRoadEntity(entity, iterator); } } continue; @@ -835,7 +836,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl case "DROPPED_ITEM": if (Settings.Enabled_Components.KILL_ROAD_ITEMS && plotArea.getOwnedPlotAbs(BukkitUtil.adapt(entity.getLocation())) == null) { - entity.remove(); + this.removeRoadEntity(entity, iterator); } // dropped item continue; @@ -866,8 +867,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (entity.hasMetadata("ps-tmp-teleport")) { continue; } - iterator.remove(); - entity.remove(); + this.removeRoadEntity(entity, iterator); } } } @@ -972,8 +972,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (entity.hasMetadata("ps-tmp-teleport")) { continue; } - iterator.remove(); - entity.remove(); + this.removeRoadEntity(entity, iterator); } } } else { @@ -984,8 +983,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (entity.hasMetadata("ps-tmp-teleport")) { continue; } - iterator.remove(); - entity.remove(); + this.removeRoadEntity(entity, iterator); } } } @@ -999,6 +997,17 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl }), TaskTime.seconds(1L)); } + private void removeRoadEntity(Entity entity, Iterator entityIterator) { + RemoveRoadEntityEvent event = eventDispatcher.callRemoveRoadEntity(BukkitAdapter.adapt(entity)); + + if (event.getEventResult() == Result.DENY) { + return; + } + + entityIterator.remove(); + entity.remove(); + } + @Override public @Nullable final ChunkGenerator getDefaultWorldGenerator( diff --git a/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java b/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java new file mode 100644 index 000000000..5642342b6 --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java @@ -0,0 +1,63 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * Copyright (C) IntellectualSites team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.plotsquared.core.events; + +import com.sk89q.worldedit.entity.Entity; +import org.checkerframework.checker.nullness.qual.NonNull; + +/** + * @since TODO + */ +public abstract class EntityEvent { + + private final Entity entity; + + private String name; + + /** + * @since TODO + */ + public EntityEvent(Entity entity) { + this.entity = entity; + } + + /** + * Obtain the entity involved in the event + * + * @return Entity + * @since TODO + */ + public Entity getEntity() { + return this.entity; + } + + /** + * Obtain the event's class name + * + * @return the event class name + * @since TODO + */ + @NonNull public String getEventName() { + if (this.name == null) { + this.name = this.getClass().getSimpleName(); + } + return this.name; + } + +} diff --git a/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java b/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java new file mode 100644 index 000000000..aa7155cc7 --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java @@ -0,0 +1,50 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * Copyright (C) IntellectualSites team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.plotsquared.core.events; + +import com.sk89q.worldedit.entity.Entity; + +/** + * @since TODO + */ +public class RemoveRoadEntityEvent extends EntityEvent implements CancellablePlotEvent { + + private Result eventResult; + + /** + * RemoveRoadEntityEvent: Called when an entity on road is removed. + * + * @param entity The entity to remove + * @since TODO + */ + public RemoveRoadEntityEvent(Entity entity) { + super(entity); + } + + @Override + public Result getEventResult() { + return this.eventResult; + } + + @Override + public void setEventResult(Result eventResult) { + this.eventResult = eventResult; + } + +} diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java index 9318cccd0..f935c50f7 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java @@ -45,6 +45,7 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotUnlinkEvent; +import com.plotsquared.core.events.RemoveRoadEntityEvent; import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent; import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent; @@ -71,6 +72,7 @@ import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -296,6 +298,12 @@ public class EventDispatcher { return event; } + public RemoveRoadEntityEvent callRemoveRoadEntity(Entity entity) { + RemoveRoadEntityEvent event = new RemoveRoadEntityEvent(entity); + eventBus.post(event); + return event; + } + public void doJoinTask(final PlotPlayer player) { if (player == null) { return; //possible future warning message to figure out where we are retrieving null From 773fd6f59f21d707698088a830942e8b09905e2d Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 10 Feb 2023 17:12:15 +0100 Subject: [PATCH 15/27] Release 6.11.0 --- .../plotsquared/bukkit/generator/BukkitPlotGenerator.java | 2 +- .../main/java/com/plotsquared/core/events/EntityEvent.java | 6 +++--- .../com/plotsquared/core/events/RemoveRoadEntityEvent.java | 4 ++-- .../java/com/plotsquared/core/util/SchematicHandler.java | 2 +- Core/src/main/java/com/plotsquared/core/util/WorldUtil.java | 2 +- build.gradle.kts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index fda56eaf3..5d6dd8409 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -166,7 +166,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap * The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point * release. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "6.11.0") @Override public @NonNull ChunkData generateChunkData( @NonNull World world, @NonNull Random random, int x, int z, diff --git a/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java b/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java index 5642342b6..108f7d75b 100644 --- a/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/EntityEvent.java @@ -31,7 +31,7 @@ public abstract class EntityEvent { private String name; /** - * @since TODO + * @since 6.11.0 */ public EntityEvent(Entity entity) { this.entity = entity; @@ -41,7 +41,7 @@ public abstract class EntityEvent { * Obtain the entity involved in the event * * @return Entity - * @since TODO + * @since 6.11.0 */ public Entity getEntity() { return this.entity; @@ -51,7 +51,7 @@ public abstract class EntityEvent { * Obtain the event's class name * * @return the event class name - * @since TODO + * @since 6.11.0 */ @NonNull public String getEventName() { if (this.name == null) { diff --git a/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java b/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java index aa7155cc7..5b32e2652 100644 --- a/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/RemoveRoadEntityEvent.java @@ -21,7 +21,7 @@ package com.plotsquared.core.events; import com.sk89q.worldedit.entity.Entity; /** - * @since TODO + * @since 6.11.0 */ public class RemoveRoadEntityEvent extends EntityEvent implements CancellablePlotEvent { @@ -31,7 +31,7 @@ public class RemoveRoadEntityEvent extends EntityEvent implements CancellablePlo * RemoveRoadEntityEvent: Called when an entity on road is removed. * * @param entity The entity to remove - * @since TODO + * @since 6.11.0 */ public RemoveRoadEntityEvent(Entity entity) { super(entity); diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index 7d2993ed2..c3f75e649 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -494,7 +494,7 @@ public abstract class SchematicHandler { /** * The legacy web interface is deprecated for removal in favor of Arkitektonika. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "6.11.0") public List getSaves(UUID uuid) { String rawJSON; try { diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java index 1861be25b..83bc0425f 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -255,7 +255,7 @@ public abstract class WorldUtil { /** * The legacy web interface is deprecated for removal in favor of Arkitektonika. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "6.11.0") public void upload( final @NonNull Plot plot, final @Nullable UUID uuid, diff --git a/build.gradle.kts b/build.gradle.kts index 19635d1e8..497bbdd4e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { } group = "com.plotsquared" -version = "6.10.10-SNAPSHOT" +version = "6.11.0" if (!File("$rootDir/.git").exists()) { logger.lifecycle(""" From 72bb5f00b02808ddcf90b02130916266d73b50d0 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 10 Feb 2023 17:16:52 +0100 Subject: [PATCH 16/27] Back to snapshot for development --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 497bbdd4e..4e44868c0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { } group = "com.plotsquared" -version = "6.11.0" +version = "6.11.1-SNAPSHOT" if (!File("$rootDir/.git").exists()) { logger.lifecycle(""" From 888682e5d0493b87189f03d3652047386970e475 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 11 Feb 2023 09:35:21 +0100 Subject: [PATCH 17/27] Update dependency com.intellectualsites.bom:bom-1.18.x to v1.24 (#3960) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4e44868c0..c62b7a708 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,7 +74,7 @@ subprojects { } dependencies { - implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.23")) + implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.24")) } dependencies { From ed33635a15c2ab76e509b5600b7bc42fa3586e85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 11 Feb 2023 09:35:35 +0100 Subject: [PATCH 18/27] Update dependency com.diffplug.spotless to v6.15.0 (#3959) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fc02d8785..1056e32a6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ http4j = "1.3" # Gradle plugins shadow = "7.1.2" grgit = "4.1.1" -spotless = "6.14.1" +spotless = "6.15.0" nexus = "1.1.0" [libraries] From 5a55a1f6029e6cc8d13bd246b07cab26fdb910ef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 23:47:13 +0100 Subject: [PATCH 19/27] Update dependency io.github.gradle-nexus.publish-plugin to v1.2.0 (#3966) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1056e32a6..17b5a85b7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,7 +22,7 @@ http4j = "1.3" shadow = "7.1.2" grgit = "4.1.1" spotless = "6.15.0" -nexus = "1.1.0" +nexus = "1.2.0" [libraries] # Platform expectations From 94ca5cf679c81cb896f9dc6d96e767d4d8a7f2be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 23:47:31 +0100 Subject: [PATCH 20/27] Update dependency cloud.commandframework:cloud-services to v1.8.1 (#3965) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17b5a85b7..95a861b45 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ mvdwapi = "3.1.1" # Third party prtree = "2.0.0" aopalliance = "1.0" -cloud-services = "1.8.0" +cloud-services = "1.8.1" arkitektonika = "2.1.1" squirrelid = "0.3.1" http4j = "1.3" From f5118e68028c4934edeb6380cac71bc5fab4f37f Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 23 Feb 2023 09:26:30 +0100 Subject: [PATCH 21/27] Don't fire 'PlotUnlinkEvent' twice on plot clear (#3947) --- Core/src/main/java/com/plotsquared/core/command/Clear.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Clear.java b/Core/src/main/java/com/plotsquared/core/command/Clear.java index 83a612951..039c37280 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Clear.java +++ b/Core/src/main/java/com/plotsquared/core/command/Clear.java @@ -106,7 +106,6 @@ public class Clear extends Command { BackupManager.backup(player, plot, () -> { final long start = System.currentTimeMillis(); boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> { - plot.getPlotModificationManager().unlink(); TaskManager.runTask(() -> { plot.removeRunning(); // If the state changes, then mark it as no longer done From 97cdd03ea4350b2223c0403e60178cd7b8dd436c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 21:24:04 +0100 Subject: [PATCH 22/27] Update dependency gradle to v7.6.1 (#3967) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33c4..508322917 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From dd6eb8e74ff4e0857c3bab7d511f296f7fa464ab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 00:46:19 +0100 Subject: [PATCH 23/27] Update dependency cloud.commandframework:cloud-services to v1.8.2 (#3971) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 95a861b45..d683df484 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ mvdwapi = "3.1.1" # Third party prtree = "2.0.0" aopalliance = "1.0" -cloud-services = "1.8.1" +cloud-services = "1.8.2" arkitektonika = "2.1.1" squirrelid = "0.3.1" http4j = "1.3" From b2ab61559c0e8ee45698a0a3651a450a1819d0f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 00:46:34 +0100 Subject: [PATCH 24/27] Update dependency com.diffplug.spotless to v6.16.0 (#3970) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d683df484..4a6c89d2a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ http4j = "1.3" # Gradle plugins shadow = "7.1.2" grgit = "4.1.1" -spotless = "6.15.0" +spotless = "6.16.0" nexus = "1.2.0" [libraries] From e98f628d34a0d340e464aa2da1359c5e0bb31603 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 2 Mar 2023 12:30:14 +0100 Subject: [PATCH 25/27] Pin GH actions to SHA to avoid mutable refs (#3973) --- .../workflows/announce-release-on-discord.yml | 3 +-- .github/workflows/build-pr.yml | 8 +++----- .github/workflows/build.yml | 8 +++----- .github/workflows/codeql.yml | 17 +++++------------ .github/workflows/release-drafter.yml | 6 ++---- 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/.github/workflows/announce-release-on-discord.yml b/.github/workflows/announce-release-on-discord.yml index 4e0eeef84..717c8ca0f 100644 --- a/.github/workflows/announce-release-on-discord.yml +++ b/.github/workflows/announce-release-on-discord.yml @@ -2,7 +2,6 @@ name: Announce release on discord on: release: types: [published] - jobs: send_announcement: runs-on: ubuntu-latest @@ -12,7 +11,7 @@ jobs: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} DISCORD_USERNAME: PlotSquared Release DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png - uses: Ilshidur/action-discord@0.3.2 + uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9 # ratchet:Ilshidur/action-discord@0.3.2 with: args: | "<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>" diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index b1ffd45a4..6ec60c0b1 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -1,19 +1,17 @@ name: Build PR - -on: [ pull_request ] - +on: [pull_request] jobs: build_pr: if: github.repository_owner == 'IntellectualSites' runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1 - name: Setup Java uses: actions/setup-java@v3 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7d6fa81c..22bbf5b7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,8 @@ name: build - on: push: branches: - v6 - jobs: build: if: github.repository_owner == 'IntellectualSites' @@ -13,7 +11,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1 - name: Setup Java uses: actions/setup-java@v3 with: @@ -45,7 +43,7 @@ jobs: ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - name: Publish core javadoc if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}} - uses: cpina/github-action-push-to-another-repository@main + uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main env: SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} with: @@ -57,7 +55,7 @@ jobs: target-directory: core - name: Publish bukkit javadoc if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}} - uses: cpina/github-action-push-to-another-repository@main + uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main env: SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 625a76a13..7ead4f468 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,10 +1,8 @@ name: "CodeQL" - on: pull_request: # The branches below must be a subset of the branches above - branches: [ v6 ] - + branches: [v6] jobs: analyze: name: Analyze @@ -13,23 +11,18 @@ jobs: actions: read contents: read security-events: write - strategy: fail-fast: false matrix: - language: [ 'java' ] - + language: ['java'] steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2 with: languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - + uses: github/codeql-action/autobuild@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 6fa4b5347..35dd31ae2 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,14 +1,12 @@ name: draft release - on: push: branches: - v6 pull_request: - types: [ opened, reopened, synchronize ] + types: [opened, reopened, synchronize] pull_request_target: - types: [ opened, reopened, synchronize ] - + types: [opened, reopened, synchronize] jobs: update_release_draft: if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} From d1bac90745b964b5f09b2b38e2a6c6c382d1bb82 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 2 Mar 2023 20:48:33 +0100 Subject: [PATCH 26/27] Update developers field --- CODE_OF_CONDUCT.md | 2 +- build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e40107c03..ce10a4445 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at contact@intellectualsites.com. All +reported by contacting the project team at contactintellectualsites.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/build.gradle.kts b/build.gradle.kts index c62b7a708..955b45a01 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -155,7 +155,7 @@ subprojects { id.set("NotMyFault") name.set("Alexander Brandes") organization.set("IntellectualSites") - email.set("contact@notmyfault.dev") + email.set("contact(at)notmyfault.dev") } developer { id.set("SirYwell") From f11acacedd9612f4a874ad7d2c239eeb72a4758f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:36:18 +0100 Subject: [PATCH 27/27] Update dependency com.intellectualsites.prtree:PRTree to v2.0.1 (#3975) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4a6c89d2a..33a64e7ec 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ essentialsx = "2.19.7" mvdwapi = "3.1.1" # Third party -prtree = "2.0.0" +prtree = "2.0.1" aopalliance = "1.0" cloud-services = "1.8.2" arkitektonika = "2.1.1"