mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Introduce edit-sign
flag (#4236)
This commit is contained in:
@ -42,6 +42,7 @@ import com.plotsquared.core.plot.flag.implementations.DeviceInteractFlag;
|
||||
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.EditSignFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.EntityCapFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.EntityChangeBlockFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
||||
@ -153,6 +154,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
||||
this.addFlag(DeviceInteractFlag.DEVICE_INTERACT_FALSE);
|
||||
this.addFlag(DisablePhysicsFlag.DISABLE_PHYSICS_FALSE);
|
||||
this.addFlag(DropProtectionFlag.DROP_PROTECTION_FALSE);
|
||||
this.addFlag(EditSignFlag.EDIT_SIGN_FALSE);
|
||||
this.addFlag(EntityChangeBlockFlag.ENTITY_CHANGE_BLOCK_FALSE);
|
||||
this.addFlag(ExplosionFlag.EXPLOSION_FALSE);
|
||||
this.addFlag(ForcefieldFlag.FORCEFIELD_FALSE);
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
*/
|
||||
public class EditSignFlag extends BooleanFlag<EditSignFlag> {
|
||||
public static final EditSignFlag EDIT_SIGN_TRUE = new EditSignFlag(true);
|
||||
public static final EditSignFlag EDIT_SIGN_FALSE = new EditSignFlag(false);
|
||||
|
||||
private EditSignFlag(final boolean value) {
|
||||
super(value, TranslatableCaption.of("flags.flag_description_edit_sign"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EditSignFlag flagOf(@NonNull final Boolean value) {
|
||||
return value ? EDIT_SIGN_TRUE : EDIT_SIGN_FALSE;
|
||||
}
|
||||
|
||||
}
|
@ -63,6 +63,7 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DeviceInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.EditSignFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.MiscPlaceFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.MobPlaceFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PlaceFlag;
|
||||
@ -74,6 +75,7 @@ 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.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@ -392,6 +394,12 @@ public class EventDispatcher {
|
||||
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) {
|
||||
return true;
|
||||
}
|
||||
// we check for the EditSignFlag in the PlayerSignOpenEvent again, but we must not cancel the interact event
|
||||
// or send a message if the flag is true
|
||||
if (BlockCategories.ALL_SIGNS != null && BlockCategories.ALL_SIGNS.contains(blockType)
|
||||
&& plot.getFlag(EditSignFlag.class)) {
|
||||
return true;
|
||||
}
|
||||
if (notifyPerms) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
|
||||
|
@ -555,6 +555,7 @@
|
||||
"flags.flag_description_device_interact": "<gray>Set to `true` to allow devices to be interacted with in the plot.</gray>",
|
||||
"flags.flag_description_disable_physics": "<gray>Set to `true` to disable block physics in the plot.</gray>",
|
||||
"flags.flag_description_drop_protection": "<gray>Set to `true` to prevent dropped items from being picked up by non-members of the plot.</gray>",
|
||||
"flags.flag_description_edit_sign": "<gray>Set to `true` to allow editing signs in the plot.</gray>",
|
||||
"flags.flag_description_feed": "<gray>Specify an interval in seconds and an optional amount by which the players will be fed (amount is 1 by default).</gray>",
|
||||
"flags.flag_description_forcefield": "<gray>Set to `true` to enable member forcefield in the plot.</gray>",
|
||||
"flags.flag_description_grass_grow": "<gray>Set to `false` to prevent grass from growing within the plot.</gray>",
|
||||
|
Reference in New Issue
Block a user