diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index a21ecc787..b5315f3d0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,6 +8,7 @@ body: value: | Thanks for taking the time to fill out this bug report for PlotSquared! Fill out the following form to your best ability to help us fix the problem. Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki). + Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://forms.gle/btgdRn9yhGtzEiGW8) form! - type: dropdown attributes: @@ -28,6 +29,7 @@ body: description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. multiple: false options: + - '1.17.1' - '1.16.5' - '1.15.2' - '1.14.4' diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 16cc1ab85..4f524baf7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ blank_issues_enabled: false contact_links: + - name: Reporting Security Vulnerabilities + url: https://forms.gle/btgdRn9yhGtzEiGW8 + about: Use this form to report security vulnerabilities. Do not use the public issue tracker. - name: IntellectualSites Discord url: https://discord.gg/intellectualsites about: Our support Discord, please ask questions and seek support here. diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index 1a538aedf..225a431c3 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -102,10 +102,10 @@ tasks.named("shadowJar") { tasks { withType { val opt = options as StandardJavadocDocletOptions - opt.links("https://papermc.io/javadocs/paper/1.16/") - opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.5/") - opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.5/") - opt.links("https://jd.adventure.kyori.net/api/4.8.0/") + opt.links("https://papermc.io/javadocs/paper/1.17/") + opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.6-SNAPSHOT/") + opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.6-SNAPSHOT/") + opt.links("https://jd.adventure.kyori.net/api/4.8.1/") opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://checkerframework.org/api/") } 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 aa5bfb60b..65f95d319 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -52,6 +52,7 @@ import com.plotsquared.core.plot.flag.implementations.InstabreakFlag; import com.plotsquared.core.plot.flag.implementations.KelpGrowFlag; import com.plotsquared.core.plot.flag.implementations.LeafDecayFlag; import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag; +import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag; import com.plotsquared.core.plot.flag.implementations.MycelGrowFlag; import com.plotsquared.core.plot.flag.implementations.PlaceFlag; import com.plotsquared.core.plot.flag.implementations.RedstoneFlag; @@ -77,6 +78,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Entity; import org.bukkit.entity.Fireball; +import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; @@ -96,6 +98,7 @@ import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockReceiveGameEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.CauldronLevelChangeEvent; @@ -457,6 +460,7 @@ public class BlockEventListener implements Listener { break; case "WEEPING_VINES": case "TWISTING_VINES": + case "CAVE_VINES": case "VINE": if (!plot.getFlag(VineGrowFlag.class)) { plot.debug("Vine could not grow because vine-grow = false"); @@ -468,6 +472,11 @@ public class BlockEventListener implements Listener { plot.debug("Kelp could not grow because kelp-grow = false"); event.setCancelled(true); } + case "BUDDING_AMETHYST": + if (!plot.getFlag(CropGrowFlag.class)) { + plot.debug("Amethyst clusters could not grow because crop-grow = false"); + event.setCancelled(true); + } break; } } @@ -948,7 +957,7 @@ public class BlockEventListener implements Listener { public void onBlockDispense(BlockDispenseEvent event) { Material type = event.getItem().getType(); switch (type) { - case SHULKER_BOX, WHITE_SHULKER_BOX, ORANGE_SHULKER_BOX, MAGENTA_SHULKER_BOX, LIGHT_BLUE_SHULKER_BOX, YELLOW_SHULKER_BOX, LIME_SHULKER_BOX, PINK_SHULKER_BOX, GRAY_SHULKER_BOX, LIGHT_GRAY_SHULKER_BOX, CYAN_SHULKER_BOX, PURPLE_SHULKER_BOX, BLUE_SHULKER_BOX, BROWN_SHULKER_BOX, GREEN_SHULKER_BOX, RED_SHULKER_BOX, BLACK_SHULKER_BOX, CARVED_PUMPKIN, WITHER_SKELETON_SKULL, FLINT_AND_STEEL, BONE_MEAL, SHEARS, GLASS_BOTTLE, GLOWSTONE, COD_BUCKET, PUFFERFISH_BUCKET, SALMON_BUCKET, TROPICAL_FISH_BUCKET, BUCKET, WATER_BUCKET, LAVA_BUCKET -> { + case SHULKER_BOX, WHITE_SHULKER_BOX, ORANGE_SHULKER_BOX, MAGENTA_SHULKER_BOX, LIGHT_BLUE_SHULKER_BOX, YELLOW_SHULKER_BOX, LIME_SHULKER_BOX, PINK_SHULKER_BOX, GRAY_SHULKER_BOX, LIGHT_GRAY_SHULKER_BOX, CYAN_SHULKER_BOX, PURPLE_SHULKER_BOX, BLUE_SHULKER_BOX, BROWN_SHULKER_BOX, GREEN_SHULKER_BOX, RED_SHULKER_BOX, BLACK_SHULKER_BOX, CARVED_PUMPKIN, WITHER_SKELETON_SKULL, FLINT_AND_STEEL, BONE_MEAL, SHEARS, GLASS_BOTTLE, GLOWSTONE, COD_BUCKET, PUFFERFISH_BUCKET, SALMON_BUCKET, TROPICAL_FISH_BUCKET, AXOLOTL_BUCKET, BUCKET, WATER_BUCKET, LAVA_BUCKET -> { if (event.getBlock().getType() == Material.DROPPER) { return; } @@ -1177,4 +1186,41 @@ public class BlockEventListener implements Listener { } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onBlockReceiveGame(BlockReceiveGameEvent event) { + Block block = event.getBlock(); + Location location = BukkitUtil.adapt(block.getLocation()); + Entity entity = event.getEntity(); + + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + + Plot plot = location.getOwnedPlot(); + if (plot == null || !plot.getFlag(MiscInteractFlag.class)) { + if (entity instanceof Player player) { + BukkitPlayer plotPlayer = BukkitUtil.adapt(player); + if (plot != null) { + if (!plot.isAdded(plotPlayer.getUUID())) { + plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because misc-interact = false"); + event.setCancelled(true); + } + } + return; + } + if (entity instanceof Item item) { + UUID itemThrower = item.getThrower(); + if (!plot.isAdded(itemThrower)) { + if (plot != null) { + if (!plot.isAdded(itemThrower)) { + plot.debug("A thrown item couldn't trigger sculk sensors because misc-interact = false"); + event.setCancelled(true); + } + } + } + } + } + } + } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index 2ffe6e34e..bf737c001 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -34,9 +34,9 @@ import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag; +import com.plotsquared.core.plot.flag.implementations.EntityChangeBlockFlag; import com.plotsquared.core.plot.flag.implementations.ExplosionFlag; import com.plotsquared.core.plot.flag.implementations.InvincibleFlag; -import com.plotsquared.core.plot.flag.implementations.MobPlaceFlag; import com.plotsquared.core.plot.world.PlotAreaManager; import org.bukkit.Material; import org.bukkit.World; @@ -315,11 +315,10 @@ public class EntityEventListener implements Listener { PlotArea area = location.getPlotArea(); if (area != null) { Plot plot = area.getOwnedPlot(location); - if (plot != null && !plot.getFlag(MobPlaceFlag.class)) { - plot.debug(e.getType() + " could not change block because mob-place = false"); - return; + if (plot != null && !plot.getFlag(EntityChangeBlockFlag.class)) { + plot.debug(e.getType() + " could not change block because entity-change-block = false"); + event.setCancelled(true); } - event.setCancelled(true); } } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 9f3253fa7..91344e87c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -1073,6 +1073,7 @@ public class PlayerEventListener extends PlotListener implements Listener { case WHEAT_SEEDS: case BEETROOT_SEEDS: case SWEET_BERRIES: + case GLOW_BERRIES: return; default: //eventType = PlayerBlockEventType.PLACE_BLOCK; diff --git a/Core/build.gradle.kts b/Core/build.gradle.kts index 683a360de..491aa9de6 100644 --- a/Core/build.gradle.kts +++ b/Core/build.gradle.kts @@ -5,17 +5,11 @@ dependencies { compileOnlyApi(libs.checkerqual) // Minecraft expectations - compileOnlyApi(libs.guava) { - because("Minecraft uses 21.0") - } - compileOnlyApi(libs.gson) { - because("Minecraft uses 2.8.0") - } + compileOnlyApi(libs.guava) + compileOnlyApi(libs.gson) // Platform expectations - compileOnlyApi(libs.snakeyaml) { - because("Bukkit uses 1.27") - } + compileOnlyApi(libs.snakeyaml) // Adventure api(libs.adventure) @@ -41,9 +35,7 @@ dependencies { testImplementation(libs.fastasyncworldeditBukkit) // Logging - compileOnlyApi(libs.log4j) { - because("Minecraft uses 2.8.1") - } + compileOnlyApi(libs.log4j) // Other libraries api(libs.prtree) diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java index 007095363..4672fe28e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java @@ -47,6 +47,7 @@ import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DropProtectionFlag; import com.plotsquared.core.plot.flag.implementations.EntityCapFlag; +import com.plotsquared.core.plot.flag.implementations.EntityChangeBlockFlag; import com.plotsquared.core.plot.flag.implementations.ExplosionFlag; import com.plotsquared.core.plot.flag.implementations.FarewellFlag; import com.plotsquared.core.plot.flag.implementations.FeedFlag; @@ -191,6 +192,7 @@ public final class GlobalFlagContainer extends FlagContainer { this.addFlag(DenyPortalTravelFlag.DENY_PORTAL_TRAVEL_FALSE); this.addFlag(DenyPortalsFlag.DENY_PORTALS_FALSE); this.addFlag(LecternReadBookFlag.LECTERN_READ_BOOK_FALSE); + this.addFlag(EntityChangeBlockFlag.ENTITY_CHANGE_BLOCK_FALSE); // Enum Flags this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityChangeBlockFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityChangeBlockFlag.java new file mode 100644 index 000000000..77b34bfc8 --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityChangeBlockFlag.java @@ -0,0 +1,46 @@ +/* + * _____ _ _ _____ _ + * | __ \| | | | / ____| | | + * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | + * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | + * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | + * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| + * | | + * |_| + * PlotSquared plot management system for Minecraft + * Copyright (C) 2021 IntellectualSites + * + * 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.plot.flag.implementations; + +import com.plotsquared.core.configuration.caption.TranslatableCaption; +import com.plotsquared.core.plot.flag.types.BooleanFlag; +import org.checkerframework.checker.nullness.qual.NonNull; + +public class EntityChangeBlockFlag extends BooleanFlag { + + public static final EntityChangeBlockFlag ENTITY_CHANGE_BLOCK_TRUE = new EntityChangeBlockFlag(true); + public static final EntityChangeBlockFlag ENTITY_CHANGE_BLOCK_FALSE = new EntityChangeBlockFlag(false); + + private EntityChangeBlockFlag(boolean value) { + super(value, TranslatableCaption.of("flags.flag_description_entity_change_block")); + } + + @Override + protected EntityChangeBlockFlag flagOf(@NonNull Boolean value) { + return value ? ENTITY_CHANGE_BLOCK_TRUE : ENTITY_CHANGE_BLOCK_FALSE; + } + +} diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 01e02e323..ec557dca8 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -565,6 +565,7 @@ "flags.flag_description_mob_break": "Set to `true` to allow mobs to break blocks within the plot.", "flags.flag_description_mob_cap": "Set to an integer value to limit the amount of mobs on the plot.", "flags.flag_description_mob_place": "Set to `true` to allow mobs to place blocks within the plot.", + "flags.flag_description_entity_change_block": "Set to `true` to allow entities to change blocks within the plot, if not covered by other flags.", "flags.flag_description_mycel_grow": "Set to `false` to prevent mycelium from growing in the plot.", "flags.flag_description_notify_enter": "Set to `true` to notify the plot owners when someone enters the plot.", "flags.flag_description_notify_leave": "Set to `true` to notify the plot owners when someone leaves the plot.", diff --git a/README.md b/README.md index 4c2ea192e..326786834 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ is to provide a lag-free and smooth experience. Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module. # Contributing -See [here](https://github.com/IntellectualSites/PlotSquared/blob/v5/CONTRIBUTING.md) +See [here](https://github.com/IntellectualSites/PlotSquared/blob/v6/CONTRIBUTING.md) ## Suggestions Suggestions are welcome! We have a separate issue tracker for suggestions, that can be found in [this](https://github.com/IntellectualSites/PlotSquaredSuggestions) repository. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4e1160fc5..59e9c05be 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,19 +1,19 @@ [versions] checker-qual = "3.14.0" -guava = "21.0" -gson = "2.8.0" +guava = "21.0" # Version set by Minecraft +gson = "2.8.0" # Version set by Minecraft -snakeyaml = "1.27" +snakeyaml = "1.28" # Version set by Bukkit -adventure-api = "4.8.0" +adventure-api = "4.8.1" adventure-text-minimessage = "4.1.0-SNAPSHOT" adventure-platform-bukkit = "4.0.0-SNAPSHOT" guice = "5.0.1" findbugs = "3.0.1" -worldedit = "7.2.5" +worldedit = "7.2.6-SNAPSHOT" fawe = "p2v6-9" vault = "1.7" placeholderapi = "2.10.9" @@ -21,7 +21,7 @@ luckperms = "5.3" essentialsx = "2.18.2" hyperverse = "0.6.0-SNAPSHOT" -log4j-api = "2.8.1" +log4j-api = "2.14.1" # Version set by Minecraft prtree = "1.7.0-SNAPSHOT" aopalliance = "1.0" @@ -32,7 +32,7 @@ paster = "1.0.2-SNAPSHOT" bstats = "2.2.1" -paper = "1.16.5-R0.1-SNAPSHOT" +paper = "1.17-R0.1-SNAPSHOT" paperlib = "1.0.6" mvdwapi = "3.1.1" @@ -91,5 +91,5 @@ paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref bstats = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" } # Paper -paper = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paper" } +paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" } paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }