feat: add projectile-change-block flag

- closes #4081
This commit is contained in:
dordsor21 2023-10-01 11:14:42 +01:00
parent d95c74d8c9
commit 7c911c919e
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 44 additions and 1 deletions

View File

@ -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.EntityChangeBlockFlag;
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag; import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag; 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.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.PlotFlagUtil; import com.plotsquared.core.util.PlotFlagUtil;
@ -360,7 +361,7 @@ public class EntityEventListener implements Listener {
} }
return; 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; return;
} }
entity.remove(); entity.remove();

View File

@ -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.PlotTitleFlag;
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag; import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
import com.plotsquared.core.plot.flag.implementations.PriceFlag; 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.ProjectilesFlag;
import com.plotsquared.core.plot.flag.implementations.PveFlag; import com.plotsquared.core.plot.flag.implementations.PveFlag;
import com.plotsquared.core.plot.flag.implementations.PvpFlag; 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(NoWorldeditFlag.NO_WORLDEDIT_FALSE);
this.addFlag(PlayerInteractFlag.PLAYER_INTERACT_FALSE); this.addFlag(PlayerInteractFlag.PLAYER_INTERACT_FALSE);
this.addFlag(PreventCreativeCopyFlag.PREVENT_CREATIVE_COPY_FALSE); this.addFlag(PreventCreativeCopyFlag.PREVENT_CREATIVE_COPY_FALSE);
this.addFlag(ProjectileChangeBlockFlag.PROJECTILE_CHANGE_BLOCK_FALSE);
this.addFlag(PveFlag.PVE_FALSE); this.addFlag(PveFlag.PVE_FALSE);
this.addFlag(PvpFlag.PVP_FALSE); this.addFlag(PvpFlag.PVP_FALSE);
this.addFlag(RedstoneFlag.REDSTONE_TRUE); this.addFlag(RedstoneFlag.REDSTONE_TRUE);

View File

@ -0,0 +1,39 @@
/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* 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 <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 ProjectileChangeBlockFlag extends BooleanFlag<ProjectileChangeBlockFlag> {
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;
}
}

View File

@ -587,6 +587,7 @@
"flags.flag_description_place": "<gray>Define a list of materials players should be able to place in the plot.</gray>", "flags.flag_description_place": "<gray>Define a list of materials players should be able to place in the plot.</gray>",
"flags.flag_description_player_interact": "<gray>Set to `true` to allow guests to interact with players in the plot.</gray>", "flags.flag_description_player_interact": "<gray>Set to `true` to allow guests to interact with players in the plot.</gray>",
"flags.flag_description_price": "<gray>Set a price for a plot. Must be a positive decimal number.</gray>", "flags.flag_description_price": "<gray>Set a price for a plot. Must be a positive decimal number.</gray>",
"flags.flag_description_projectile_change_block": "<gray>Set to `true` to allow projectiles to change blocks (tnt, etc.) on the plot.</gray>",
"flags.flag_description_pve": "<gray>Set to `true` to enable PVE inside the plot.</gray>", "flags.flag_description_pve": "<gray>Set to `true` to enable PVE inside the plot.</gray>",
"flags.flag_description_pvp": "<gray>Set to `true` to enable PVP inside the plot.</gray>", "flags.flag_description_pvp": "<gray>Set to `true` to enable PVP inside the plot.</gray>",
"flags.flag_description_redstone": "<gray>Set to `false` to disable redstone in the plot.</gray>", "flags.flag_description_redstone": "<gray>Set to `false` to disable redstone in the plot.</gray>",