mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Add crop-grow flag
This commit is contained in:
parent
10e2d65221
commit
027456fd77
@ -41,6 +41,7 @@ import com.plotsquared.core.plot.flag.implementations.BlockBurnFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.BlockIgnitionFlag;
|
import com.plotsquared.core.plot.flag.implementations.BlockIgnitionFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.BreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.BreakFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.CoralDryFlag;
|
import com.plotsquared.core.plot.flag.implementations.CoralDryFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.CropGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag;
|
import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
||||||
@ -768,7 +769,17 @@ public class BlockEventListener implements Listener {
|
|||||||
public void onGrow(BlockGrowEvent event) {
|
public void onGrow(BlockGrowEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
Location location = BukkitUtil.adapt(block.getLocation());
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
if (location.isUnownedPlotArea()) {
|
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plot plot = location.getOwnedPlot();
|
||||||
|
if (plot == null || !plot.getFlag(CropGrowFlag.class)) {
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug("Crop grow event was cancelled because crop-grow = false");
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import com.plotsquared.core.plot.flag.implementations.BlockedCmdsFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.BreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.BreakFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ChatFlag;
|
import com.plotsquared.core.plot.flag.implementations.ChatFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.CoralDryFlag;
|
import com.plotsquared.core.plot.flag.implementations.CoralDryFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.CropGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DenyExitFlag;
|
import com.plotsquared.core.plot.flag.implementations.DenyExitFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DenyTeleportFlag;
|
import com.plotsquared.core.plot.flag.implementations.DenyTeleportFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||||
@ -183,6 +184,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
|||||||
this.addFlag(KeepInventoryFlag.KEEP_INVENTORY_FALSE);
|
this.addFlag(KeepInventoryFlag.KEEP_INVENTORY_FALSE);
|
||||||
this.addFlag(PreventCreativeCopyFlag.PREVENT_CREATIVE_COPY_FALSE);
|
this.addFlag(PreventCreativeCopyFlag.PREVENT_CREATIVE_COPY_FALSE);
|
||||||
this.addFlag(LeafDecayFlag.LEAF_DECAY_TRUE);
|
this.addFlag(LeafDecayFlag.LEAF_DECAY_TRUE);
|
||||||
|
this.addFlag(CropGrowFlag.CROP_GROW_TRUE);
|
||||||
|
|
||||||
// Enum Flags
|
// Enum Flags
|
||||||
this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF);
|
this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF);
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* _____ _ _ _____ _
|
||||||
|
* | __ \| | | | / ____| | |
|
||||||
|
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||||
|
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||||
|
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||||
|
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||||
|
* | |
|
||||||
|
* |_|
|
||||||
|
* PlotSquared plot management system for Minecraft
|
||||||
|
* Copyright (C) 2021 IntellectualSites
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public class CropGrowFlag extends BooleanFlag<CropGrowFlag> {
|
||||||
|
|
||||||
|
public static final CropGrowFlag CROP_GROW_TRUE = new CropGrowFlag(true);
|
||||||
|
public static final CropGrowFlag CROP_GROW_FALSE = new CropGrowFlag(false);
|
||||||
|
|
||||||
|
private CropGrowFlag(boolean value) {
|
||||||
|
super(value, TranslatableCaption.of("flags.flag_description_crop_grow"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CropGrowFlag flagOf(@NonNull Boolean value) {
|
||||||
|
return value ? CROP_GROW_TRUE : CROP_GROW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -552,6 +552,7 @@
|
|||||||
"flags.flag_description_snow_melt": "<gray>Set to `true` to allow snow to melt within the plot.</gray>",
|
"flags.flag_description_snow_melt": "<gray>Set to `true` to allow snow to melt within the plot.</gray>",
|
||||||
"flags.flag_description_soil_dry": "<gray>Set to `true` to allow soil to dry within the plot.</gray>",
|
"flags.flag_description_soil_dry": "<gray>Set to `true` to allow soil to dry within the plot.</gray>",
|
||||||
"flags.flag_description_coral_dry": "<gray>Set to `true` to allow coral blocks to dry within the plot.</gray>",
|
"flags.flag_description_coral_dry": "<gray>Set to `true` to allow coral blocks to dry within the plot.</gray>",
|
||||||
|
"flags.flag_description_crop_grow": "<gray>Set to `false` to disable crop growing on the plot</gray>",
|
||||||
"flags.flag_description_tamed_attack": "<gray>Set to `true` to allow guests to attack tamed animals in the plot.</gray>",
|
"flags.flag_description_tamed_attack": "<gray>Set to `true` to allow guests to attack tamed animals in the plot.</gray>",
|
||||||
"flags.flag_description_tamed_interact": "<gray>Set to `true` to allow guests to interact with tamed animals in the plot.</gray>",
|
"flags.flag_description_tamed_interact": "<gray>Set to `true` to allow guests to interact with tamed animals in the plot.</gray>",
|
||||||
"flags.flag_description_time": "<gray>Set the time in the plot to a fixed value.</gray>",
|
"flags.flag_description_time": "<gray>Set the time in the plot to a fixed value.</gray>",
|
||||||
|
Loading…
Reference in New Issue
Block a user