mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-02 13:33:47 +01:00
Port PlaceFlag
This commit is contained in:
parent
3bccedd95f
commit
55cfb7600d
@ -31,6 +31,7 @@ import com.github.intellectualsites.plotsquared.plot.flags.implementations.MiscB
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MiscInteractFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MiscInteractFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MobPlaceFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MobPlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MycelGrowFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MycelGrowFlag;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlayerInteractFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlayerInteractFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PveFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PveFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PvpFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PvpFlag;
|
||||||
@ -2919,7 +2920,7 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
Set<BlockType> place = plot.getFlag(Flags.PLACE, null);
|
List<BlockType> place = plot.getFlag(PlaceFlag.class);
|
||||||
if (place != null) {
|
if (place != null) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (place.contains(BukkitAdapter.asBlockType(block.getType()))) {
|
if (place.contains(BukkitAdapter.asBlockType(block.getType()))) {
|
||||||
|
@ -609,6 +609,7 @@ public enum Captions implements Caption {
|
|||||||
FLAG_DESCRIPTION_NOTIFY_ENTER("Set to `true` to notify the plot owners when someone enters 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.", "Flags"),
|
FLAG_DESCRIPTION_NOTIFY_LEAVE("Set to `true` to notify the plot owners when someone leaves the plot.", "Flags"),
|
||||||
FLAG_DESCRIPTION_NO_WORLDEDIT("Set to `true` to disable WorldEdit usage within the plot.", "Flags"),
|
FLAG_DESCRIPTION_NO_WORLDEDIT("Set to `true` to disable WorldEdit usage within the plot.", "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_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_PRICE("Set a price for a plot. Must be a positive decimal number.", "Flags"),
|
||||||
FLAG_DESCRIPTION_PVE("Set to `true` to enable PVE inside the plot.", "Flags"),
|
FLAG_DESCRIPTION_PVE("Set to `true` to enable PVE inside the plot.", "Flags"),
|
||||||
|
@ -48,6 +48,7 @@ import com.github.intellectualsites.plotsquared.plot.flags.implementations.Mycel
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NoWorldeditFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NoWorldeditFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NotifyEnterFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NotifyEnterFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NotifyLeaveFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.NotifyLeaveFlag;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlayerInteractFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlayerInteractFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlotWeatherFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlotWeatherFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PriceFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PriceFlag;
|
||||||
@ -161,6 +162,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
|||||||
|
|
||||||
// Block type list flags
|
// Block type list flags
|
||||||
this.addFlag(BreakFlag.BREAK_NONE);
|
this.addFlag(BreakFlag.BREAK_NONE);
|
||||||
|
this.addFlag(PlaceFlag.PLACE_NONE);
|
||||||
|
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.github.intellectualsites.plotsquared.plot.flags.implementations;
|
||||||
|
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.flags.types.BlockTypeListFlag;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PlaceFlag extends BlockTypeListFlag<PlaceFlag> {
|
||||||
|
public static final PlaceFlag PLACE_NONE = new PlaceFlag(Collections.emptyList());
|
||||||
|
|
||||||
|
protected PlaceFlag(List<BlockType> blockTypeList) {
|
||||||
|
super(blockTypeList, Captions.FLAG_DESCRIPTION_PLACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected PlaceFlag flagOf(@NotNull List<BlockType> value) {
|
||||||
|
return new PlaceFlag(value);
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.DeviceInteractFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.DeviceInteractFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MiscPlaceFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MiscPlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MobPlaceFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MobPlaceFlag;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.PlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.VehiclePlaceFlag;
|
import com.github.intellectualsites.plotsquared.plot.flags.implementations.VehiclePlaceFlag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
|
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -183,13 +184,10 @@ public abstract class EventUtil {
|
|||||||
if (plot.getFlag(MobPlaceFlag.class)) {
|
if (plot.getFlag(MobPlaceFlag.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.PLACE);
|
List<BlockType> place = plot.getFlag(PlaceFlag.class);
|
||||||
Set<BlockType> value = flagValue.orElse(null);
|
if (!place.contains(BlockTypes.AIR) && !place.contains(blockType)) {
|
||||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
if (Permissions
|
||||||
.contains(blockType)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) {
|
||||||
if (Permissions.hasPermission(player,
|
|
||||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
|
||||||
false)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil
|
return !(!notifyPerms || MainUtil
|
||||||
@ -213,13 +211,10 @@ public abstract class EventUtil {
|
|||||||
if (plot.getFlag(MiscPlaceFlag.class)) {
|
if (plot.getFlag(MiscPlaceFlag.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Optional<Set<BlockType>> flag = plot.getFlag(Flags.PLACE);
|
List<BlockType> place = plot.getFlag(PlaceFlag.class);
|
||||||
Set<BlockType> value = flag.orElse(null);
|
if (!place.contains(BlockTypes.AIR) && !place.contains(blockType)) {
|
||||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
if (Permissions
|
||||||
.contains(blockType)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) {
|
||||||
if (Permissions.hasPermission(player,
|
|
||||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
|
||||||
false)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !(!notifyPerms || MainUtil
|
return !(!notifyPerms || MainUtil
|
||||||
|
Loading…
Reference in New Issue
Block a user