mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Add option to force plot chat in plot areas.
This commit is contained in:
parent
6d9d0fff10
commit
3ee29297e0
3 changed files with 19 additions and 6 deletions
|
@ -935,11 +935,15 @@ 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) {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot == null || !plot.getFlag(ChatFlag.class)) {
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (!((plot.getFlag(ChatFlag.class) && area.isPlotChat() && plotPlayer.getAttribute("chat"))
|
||||
|| area.isForcingPlotChat())) {
|
||||
return;
|
||||
}
|
||||
if (plot.isDenied(plotPlayer.getUUID())) {
|
||||
|
|
|
@ -25,18 +25,24 @@
|
|||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "chat",
|
||||
description = "Toggle plot chat on or off",
|
||||
usage = "/plot chat [on|off]",
|
||||
description = "Toggles plot chat on or off",
|
||||
usage = "/plot chat",
|
||||
permission = "plots.chat",
|
||||
category = CommandCategory.CHAT,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
public class Chat extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null);
|
||||
if (player.getPlotAreaAbs().isForcingPlotChat()) {
|
||||
MainUtil.sendMessage(player, Captions.PLOT_CHAT_FORCED);
|
||||
return true;
|
||||
}
|
||||
MainCommand.getInstance().toggle.chat(this, player, args, null, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,8 @@ public abstract class PlotArea {
|
|||
@Getter private boolean mobSpawning = false;
|
||||
@Getter private boolean mobSpawnerSpawning = false;
|
||||
@Getter private BiomeType plotBiome = BiomeTypes.FOREST;
|
||||
@Getter private boolean plotChat = false;
|
||||
@Getter private boolean plotChat = true;
|
||||
@Getter private boolean forcingPlotChat = false;
|
||||
@Getter private boolean schematicClaimSpecify = false;
|
||||
@Getter private boolean schematicOnClaim = false;
|
||||
@Getter private String schematicFile = "null";
|
||||
|
@ -276,6 +277,7 @@ public abstract class PlotArea {
|
|||
}
|
||||
}
|
||||
this.plotChat = config.getBoolean("chat.enabled");
|
||||
this.forcingPlotChat = config.getBoolean("chat.forced");
|
||||
this.worldBorder = config.getBoolean("world.border");
|
||||
this.maxBuildHeight = config.getInt("world.max_height");
|
||||
this.minBuildHeight = config.getInt("world.min_height");
|
||||
|
@ -389,6 +391,7 @@ public abstract class PlotArea {
|
|||
options.put("economy.prices.merge", 100);
|
||||
options.put("economy.prices.sell", 100);
|
||||
options.put("chat.enabled", this.isPlotChat());
|
||||
options.put("chat.forced", this.isForcingPlotChat());
|
||||
options.put("flags.default", null);
|
||||
options.put("event.spawn.egg", this.isSpawnEggs());
|
||||
options.put("event.spawn.custom", this.isSpawnCustom());
|
||||
|
|
Loading…
Reference in a new issue