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 6c786c79b..f8cbe2ed9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -35,6 +35,7 @@ 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.ProjectileChangeBlockFlag; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.PlotFlagUtil; @@ -360,7 +361,7 @@ public class EntityEventListener implements Listener { } return; } - if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) { + if (plot.isAdded(pp.getUUID()) || plot.getFlag(ProjectileChangeBlockFlag.class) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) { return; } entity.remove(); 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 25b12d39d..5673b2c5d 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 @@ -87,6 +87,7 @@ import com.plotsquared.core.plot.flag.implementations.PlayerInteractFlag; import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag; import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag; import com.plotsquared.core.plot.flag.implementations.PriceFlag; +import com.plotsquared.core.plot.flag.implementations.ProjectileChangeBlockFlag; import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag; import com.plotsquared.core.plot.flag.implementations.PveFlag; import com.plotsquared.core.plot.flag.implementations.PvpFlag; @@ -181,6 +182,7 @@ public final class GlobalFlagContainer extends FlagContainer { this.addFlag(NoWorldeditFlag.NO_WORLDEDIT_FALSE); this.addFlag(PlayerInteractFlag.PLAYER_INTERACT_FALSE); this.addFlag(PreventCreativeCopyFlag.PREVENT_CREATIVE_COPY_FALSE); + this.addFlag(ProjectileChangeBlockFlag.PROJECTILE_CHANGE_BLOCK_FALSE); this.addFlag(PveFlag.PVE_FALSE); this.addFlag(PvpFlag.PVP_FALSE); this.addFlag(RedstoneFlag.REDSTONE_TRUE); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ProjectileChangeBlockFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ProjectileChangeBlockFlag.java new file mode 100644 index 000000000..ba957ff8e --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ProjectileChangeBlockFlag.java @@ -0,0 +1,39 @@ +/* + * 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.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 ProjectileChangeBlockFlag extends BooleanFlag { + + public static final ProjectileChangeBlockFlag PROJECTILE_CHANGE_BLOCK_TRUE = new ProjectileChangeBlockFlag(true); + public static final ProjectileChangeBlockFlag PROJECTILE_CHANGE_BLOCK_FALSE = new ProjectileChangeBlockFlag(false); + + private ProjectileChangeBlockFlag(boolean value) { + super(value, TranslatableCaption.of("flags.flag_description_projectile_change_block")); + } + + @Override + protected ProjectileChangeBlockFlag flagOf(@NonNull Boolean value) { + return value ? PROJECTILE_CHANGE_BLOCK_TRUE : PROJECTILE_CHANGE_BLOCK_FALSE; + } + +} diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 0fde34600..d5c51c798 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -587,6 +587,7 @@ "flags.flag_description_place": "Define a list of materials players should be able to place in the plot.", "flags.flag_description_player_interact": "Set to `true` to allow guests to interact with players in the plot.", "flags.flag_description_price": "Set a price for a plot. Must be a positive decimal number.", + "flags.flag_description_projectile_change_block": "Set to `true` to allow projectiles to change blocks (tnt, etc.) on the plot.", "flags.flag_description_pve": "Set to `true` to enable PVE inside the plot.", "flags.flag_description_pvp": "Set to `true` to enable PVP inside the plot.", "flags.flag_description_redstone": "Set to `false` to disable redstone in the plot.",