Add coral-dry flag

This commit is contained in:
NotMyFault 2020-03-25 21:14:58 +01:00
parent f9bf576d2e
commit 3a3a06631d
4 changed files with 42 additions and 0 deletions

View File

@ -1414,6 +1414,25 @@ public class PlayerEvents extends PlotListener implements Listener {
event.setCancelled(true);
}
break;
case TUBE_CORAL_BLOCK:
case BRAIN_CORAL_BLOCK:
case BUBBLE_CORAL_BLOCK:
case FIRE_CORAL_BLOCK:
case DEAD_HORN_CORAL_BLOCK:
case TUBE_CORAL:
case BRAIN_CORAL:
case BUBBLE_CORAL:
case FIRE_CORAL:
case HORN_CORAL:
case TUBE_CORAL_FAN:
case BRAIN_CORAL_FAN:
case BUBBLE_CORAL_FAN:
case FIRE_CORAL_FAN:
case HORN_CORAL_FAN:
if (!plot.getFlag(CoralDryFlag.class)) {
event.setCancelled(true);
}
break;
}
}

View File

@ -627,6 +627,7 @@ public enum Captions implements Caption {
FLAG_DESCRIPTION_SNOW_FORM("Set to `true` to allow snow to form within the plot.", "Flags"),
FLAG_DESCRIPTION_SNOW_MELT("Set to `true` to allow snow to melt within the plot.", "Flags"),
FLAG_DESCRIPTION_SOIL_DRY("Set to `true` to allow soil to dry within the plot.", "Flags"),
FLAG_DESCRIPTION_CORAL_DRY("Set to `true` to allow coral blocks to dry within the plot.", "Flags"),
FLAG_DESCRIPTION_TAMED_ATTACK("Set to `true` to allow guests to attack tamed animals in the plot.", "Flags"),
FLAG_DESCRIPTION_TAMED_INTERACT("Set to `true` to allow guests to interact with tamed animals in the plot.", "Flags"),
FLAG_DESCRIPTION_TIME("Set the time in the plot to a fixed value.", "Flags"),

View File

@ -60,6 +60,7 @@ import com.github.intellectualsites.plotsquared.plot.flags.implementations.Serve
import com.github.intellectualsites.plotsquared.plot.flags.implementations.SnowFormFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.SnowMeltFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.SoilDryFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.CoralDryFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.TamedAttackFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.TamedInteractFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.TimeFlag;
@ -134,6 +135,7 @@ public final class GlobalFlagContainer extends FlagContainer {
this.addFlag(SnowFormFlag.SNOW_FORM_FALSE);
this.addFlag(SnowMeltFlag.SNOW_MELT_TRUE);
this.addFlag(SoilDryFlag.SOIL_DRY_FALSE);
this.addFlag(CoralDryFlag.CORAL_DRY_FALSE);
this.addFlag(TamedAttackFlag.TAMED_ATTACK_FALSE);
this.addFlag(TamedInteractFlag.TAMED_INTERACT_FALSE);
this.addFlag(VehicleBreakFlag.VEHICLE_BREAK_FALSE);

View File

@ -0,0 +1,20 @@
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 CoralDryFlag extends BooleanFlag<CoralDryFlag> {
public static final CoralDryFlag CORAL_DRY_TRUE = new CoralDryFlag(true);
public static final CoralDryFlag CORAL_DRY_FALSE = new CoralDryFlag(false);
private CoralDryFlag(boolean value) {
super(value, Captions.FLAG_DESCRIPTION_CORAL_DRY);
}
@Override protected CoralDryFlag flagOf(@NotNull Boolean value) {
return value ? CORAL_DRY_TRUE : CORAL_DRY_FALSE;
}
}