* Minor work for 1.17

* Address TODOs

Introduce `entity-change-block` flag covering blocks affected by `onPeskyMobsChangeTheWorldLikeWTFEvent`. Previously this was covered by the mob-place flag, however, changing the tilt state of big drip leafs and a series of other blocks call `EntityChangeBlockEvent` so this shouldn't be covered by mob flags only.

* Address other TODOs

* Compile against paper 1.17

This will only work if you built paper locally and deployed it to your local maven repo.

* Updated linked javadoc links

* Handle sculk sensor events in a more controllable way

* Update issue forms for 1.17
This commit is contained in:
NotMyFault 2021-06-20 18:17:18 +02:00 committed by GitHub
parent a3ebabacb8
commit 4dbbf8f599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 123 additions and 31 deletions

View File

@ -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'

View File

@ -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.

View File

@ -102,10 +102,10 @@ tasks.named<ShadowJar>("shadowJar") {
tasks {
withType<Javadoc> {
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/")
}

View File

@ -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);
}
}
}
}
}
}
}

View File

@ -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,14 +315,13 @@ 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);
}
}
}
}
@EventHandler
public void onPrime(ExplosionPrimeEvent event) {

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<EntityChangeBlockFlag> {
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;
}
}

View File

@ -565,6 +565,7 @@
"flags.flag_description_mob_break": "<gray>Set to `true` to allow mobs to break blocks within the plot.</gray>",
"flags.flag_description_mob_cap": "<gray>Set to an integer value to limit the amount of mobs on the plot.</gray>",
"flags.flag_description_mob_place": "<gray>Set to `true` to allow mobs to place blocks within the plot.</gray>",
"flags.flag_description_entity_change_block": "<gray>Set to `true` to allow entities to change blocks within the plot, if not covered by other flags.</gray>",
"flags.flag_description_mycel_grow": "<gray>Set to `false` to prevent mycelium from growing in the plot.</gray>",
"flags.flag_description_notify_enter": "<gray>Set to `true` to notify the plot owners when someone enters the plot.</gray>",
"flags.flag_description_notify_leave": "<gray>Set to `true` to notify the plot owners when someone leaves the plot.</gray>",

View File

@ -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.

View File

@ -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" }