diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index 7a1899da7..f08ad7202 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -40,6 +40,7 @@ import com.plotsquared.core.plot.flag.implementations.BlockBurnFlag; import com.plotsquared.core.plot.flag.implementations.BlockIgnitionFlag; import com.plotsquared.core.plot.flag.implementations.BlockedCmdsFlag; import com.plotsquared.core.plot.flag.implementations.BreakFlag; +import com.plotsquared.core.plot.flag.implementations.ChatFlag; import com.plotsquared.core.plot.flag.implementations.CoralDryFlag; import com.plotsquared.core.plot.flag.implementations.DenyTeleportFlag; import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag; @@ -934,11 +935,11 @@ public class PlayerEvents extends PlotListener implements Listener { PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); Location location = plotPlayer.getLocation(); PlotArea area = location.getPlotArea(); - if (area == null || (area.isPlotChat() == plotPlayer.getAttribute("chat"))) { + if (area == null || !area.isPlotChat() || !plotPlayer.getAttribute("chat")) { return; } Plot plot = area.getPlot(location); - if (plot == null) { + if (plot == null || !plot.getFlag(ChatFlag.class)) { return; } if (plot.isDenied(plotPlayer.getUUID())) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java index fc5e369a2..e305e8f15 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java @@ -33,6 +33,7 @@ import com.plotsquared.core.plot.flag.implementations.BlockBurnFlag; import com.plotsquared.core.plot.flag.implementations.BlockIgnitionFlag; import com.plotsquared.core.plot.flag.implementations.BlockedCmdsFlag; import com.plotsquared.core.plot.flag.implementations.BreakFlag; +import com.plotsquared.core.plot.flag.implementations.ChatFlag; import com.plotsquared.core.plot.flag.implementations.CoralDryFlag; import com.plotsquared.core.plot.flag.implementations.DenyExitFlag; import com.plotsquared.core.plot.flag.implementations.DenyTeleportFlag; @@ -171,6 +172,7 @@ public final class GlobalFlagContainer extends FlagContainer { this.addFlag(ItemDropFlag.ITEM_DROP_TRUE); this.addFlag(InstabreakFlag.INSTABREAK_FALSE); this.addFlag(InvincibleFlag.INVINCIBLE_FALSE); + this.addFlag(ChatFlag.CHAT_FLAG_TRUE); // Enum Flags this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java new file mode 100644 index 000000000..af1293bbd --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java @@ -0,0 +1,45 @@ +/* + * _____ _ _ _____ _ + * | __ \| | | | / ____| | | + * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | + * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | + * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | + * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| + * | | + * |_| + * PlotSquared plot management system for Minecraft + * Copyright (C) 2020 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 . + */ +package com.plotsquared.core.plot.flag.implementations; + +import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.plot.flag.types.BooleanFlag; +import org.jetbrains.annotations.NotNull; + +public class ChatFlag extends BooleanFlag { + + public static final ChatFlag CHAT_FLAG_TRUE = new ChatFlag(true); + public static final ChatFlag CHAT_FLAG_FALSE = new ChatFlag(false); + + protected ChatFlag(boolean value) { + super(value, Captions.FLAG_DESCRIPTION_DENY_EXIT); + } + + @Override protected ChatFlag flagOf(@NotNull Boolean value) { + return value ? CHAT_FLAG_TRUE : CHAT_FLAG_FALSE; + } + +}