mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 06:36:44 +01:00
Add copper-oxide
flag
This commit is contained in:
parent
b9cb6842e2
commit
635e18e7ed
@ -31,6 +31,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
|
|||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -40,6 +41,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockFertilizeEvent;
|
import org.bukkit.event.block.BlockFertilizeEvent;
|
||||||
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
import org.bukkit.event.block.BlockReceiveGameEvent;
|
import org.bukkit.event.block.BlockReceiveGameEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -137,4 +139,44 @@ public class BlockEventListener117 implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockForm(BlockFormEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
|
if (location.isPlotRoad()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlot(location);
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.getNewState().getType()) {
|
||||||
|
case COPPER_BLOCK:
|
||||||
|
case EXPOSED_COPPER:
|
||||||
|
case WEATHERED_COPPER:
|
||||||
|
case OXIDIZED_COPPER:
|
||||||
|
case CUT_COPPER:
|
||||||
|
case EXPOSED_CUT_COPPER:
|
||||||
|
case WEATHERED_CUT_COPPER:
|
||||||
|
case OXIDIZED_CUT_COPPER:
|
||||||
|
case CUT_COPPER_STAIRS:
|
||||||
|
case EXPOSED_CUT_COPPER_STAIRS:
|
||||||
|
case WEATHERED_CUT_COPPER_STAIRS:
|
||||||
|
case OXIDIZED_CUT_COPPER_STAIRS:
|
||||||
|
case CUT_COPPER_SLAB:
|
||||||
|
case EXPOSED_CUT_COPPER_SLAB:
|
||||||
|
case WEATHERED_CUT_COPPER_SLAB:
|
||||||
|
case OXIDIZED_CUT_COPPER_SLAB:
|
||||||
|
if (!plot.getFlag(CopperOxideFlag.class)) {
|
||||||
|
plot.debug("Copper could not oxide because copper-oxide = false");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import com.plotsquared.core.plot.flag.implementations.BlockIgnitionFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.BlockedCmdsFlag;
|
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.CopperOxideFlag;
|
||||||
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.CropGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DenyExitFlag;
|
import com.plotsquared.core.plot.flag.implementations.DenyExitFlag;
|
||||||
@ -193,6 +194,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
|||||||
this.addFlag(DenyPortalsFlag.DENY_PORTALS_FALSE);
|
this.addFlag(DenyPortalsFlag.DENY_PORTALS_FALSE);
|
||||||
this.addFlag(LecternReadBookFlag.LECTERN_READ_BOOK_FALSE);
|
this.addFlag(LecternReadBookFlag.LECTERN_READ_BOOK_FALSE);
|
||||||
this.addFlag(EntityChangeBlockFlag.ENTITY_CHANGE_BLOCK_FALSE);
|
this.addFlag(EntityChangeBlockFlag.ENTITY_CHANGE_BLOCK_FALSE);
|
||||||
|
this.addFlag(CopperOxideFlag.COPPER_OXIDE_FALSE);
|
||||||
|
|
||||||
// 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 CopperOxideFlag extends BooleanFlag<CopperOxideFlag> {
|
||||||
|
|
||||||
|
public static final CopperOxideFlag COPPER_OXIDE_TRUE = new CopperOxideFlag(true);
|
||||||
|
public static final CopperOxideFlag COPPER_OXIDE_FALSE = new CopperOxideFlag(false);
|
||||||
|
|
||||||
|
private CopperOxideFlag(boolean value) {
|
||||||
|
super(value, TranslatableCaption.of("flags.flag_description_copper_oxide"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CopperOxideFlag flagOf(@NonNull Boolean value) {
|
||||||
|
return value ? COPPER_OXIDE_TRUE : COPPER_OXIDE_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -575,6 +575,7 @@
|
|||||||
"flags.flag_description_redstone": "<gray>Set to `false` to disable redstone in the plot.</gray>",
|
"flags.flag_description_redstone": "<gray>Set to `false` to disable redstone in the plot.</gray>",
|
||||||
"flags.flag_description_server_plot": "<gray>Set to `true` to turn the plot into a server plot. This is equivalent to setting the server as the plot owner.</gray>",
|
"flags.flag_description_server_plot": "<gray>Set to `true` to turn the plot into a server plot. This is equivalent to setting the server as the plot owner.</gray>",
|
||||||
"flags.flag_description_snow_form": "<gray>Set to `true` to allow snow to form within the plot.</gray>",
|
"flags.flag_description_snow_form": "<gray>Set to `true` to allow snow to form within the plot.</gray>",
|
||||||
|
"flags.flag_description_copper_oxide": "<gray>Set to `true` to allow copper to oxide 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_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>",
|
||||||
|
Loading…
Reference in New Issue
Block a user