feature: implement road flags as widely as seems reasonable

- Closes #3047
 - Any further road flag implementations would be very specific from what I can gather, and thus the gist of #3047 is now implemented
This commit is contained in:
dordsor21
2022-11-12 12:35:06 +00:00
parent 28bd993680
commit 73d57937bb
7 changed files with 66 additions and 38 deletions

View File

@ -46,6 +46,7 @@ import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.flag.types.BooleanFlag;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.queue.QueueCoordinator;
import com.plotsquared.core.util.MathMan;
@ -1242,6 +1243,18 @@ public abstract class PlotArea {
return this.roadFlagContainer.getFlag(flagClass).getValue();
}
/**
* Check if the value of a {@link BooleanFlag} matches the given boolean. If
* road flags are disabled, returns false.
*
* @param flagClass boolean flag to get value of
* @param value boolean value to check flag value against
* @return Flag value or false if road flags disabled
*/
public boolean isRoadFlagsAndFlagEquals(final Class<? extends BooleanFlag<?>> flagClass, boolean value) {
return this.roadFlags && (getRoadFlag(flagClass) == value);
}
/**
* Get the value associated with the specified road flag. This will look at
* the default values stored in {@link GlobalFlagContainer}.