mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
Port DenyExitFlag
This commit is contained in:
parent
0b1d4d4d13
commit
1c0f20910c
@ -551,6 +551,7 @@ public enum Captions implements Caption {
|
||||
FLAG_DESCRIPTION_MUSIC("Set to a music disk ID (item name) to play the music disc inside of the plot", "Flags"),
|
||||
FLAG_DESCRIPTION_FLIGHT("Set to 'true' to enable flight within the plot when in survival or adventure mode", "Flags"),
|
||||
FLAG_DESCRIPTION_UNTRUSTED("Set to 'false' to disallow untrusted players from visiting the plot", "Flags"),
|
||||
FLAG_DESCRIPTION_DENY_EXIT("Set to 'true' to disallow players from exiting the plot", "Flags"),
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Flag category errors">
|
||||
FLAG_ERROR_BOOLEAN("Flag value must be a boolean (true|false)", "Flags"),
|
||||
|
@ -109,6 +109,5 @@ public final class Flags {
|
||||
};
|
||||
|
||||
public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport");
|
||||
public static final BooleanFlag DENY_EXIT = new BooleanFlag("deny-exit");
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flags;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.DenyExitFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.ExplosionFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.FlightFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MusicFlag;
|
||||
@ -44,6 +45,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
||||
this.addFlag(MusicFlag.MUSIC_FLAG_NONE);
|
||||
this.addFlag(FlightFlag.FLIGHT_FLAG_FALSE);
|
||||
this.addFlag(UntrustedVisitFlag.UNTRUSTED_VISIT_FLAG_TRUE);
|
||||
this.addFlag(DenyExitFlag.DENY_EXIT_FLAG_TRUE);
|
||||
}
|
||||
|
||||
@Override public void addFlag(PlotFlag<?, ?> flag) {
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flags.implementations;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.types.BooleanFlag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DenyExitFlag extends BooleanFlag<DenyExitFlag> {
|
||||
|
||||
public static final DenyExitFlag DENY_EXIT_FLAG_TRUE = new DenyExitFlag(true);
|
||||
|
||||
protected DenyExitFlag(boolean value) {
|
||||
super(value, Captions.FLAG_DESCRIPTION_DENY_EXIT);
|
||||
}
|
||||
|
||||
@Override public String getExample() {
|
||||
return "true";
|
||||
}
|
||||
|
||||
@Override protected DenyExitFlag flagOf(@NotNull Boolean value) {
|
||||
return new DenyExitFlag(value);
|
||||
}
|
||||
|
||||
}
|
@ -8,8 +8,7 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
public final class MusicFlag extends PlotFlag<ItemType, MusicFlag> {
|
||||
public class MusicFlag extends PlotFlag<ItemType, MusicFlag> {
|
||||
|
||||
public static final MusicFlag MUSIC_FLAG_NONE = new MusicFlag(ItemTypes.AIR);
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class UntrustedVisitFlag extends BooleanFlag<UntrustedVisitFlag> {
|
||||
|
||||
public static UntrustedVisitFlag UNTRUSTED_VISIT_FLAG_TRUE = new UntrustedVisitFlag(true);
|
||||
public static final UntrustedVisitFlag UNTRUSTED_VISIT_FLAG_TRUE = new UntrustedVisitFlag(true);
|
||||
|
||||
protected UntrustedVisitFlag(boolean value) {
|
||||
super(value, Captions.FLAG_DESCRIPTION_UNTRUSTED);
|
||||
|
@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.DenyExitFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.FlightFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flags.implementations.MusicFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -213,7 +214,7 @@ public class PlotListener {
|
||||
if (pw == null) {
|
||||
return true;
|
||||
}
|
||||
if (Flags.DENY_EXIT.isTrue(plot)
|
||||
if (plot.getFlag(DenyExitFlag.class)
|
||||
&& !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_EXIT_DENIED)
|
||||
&& !player.getMeta("kick", false)) {
|
||||
if (previous != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user