From 3ee29297e0cd0b52ceeb0b29f9c4978b6d0cd65f Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 16 Apr 2020 16:55:14 +0100 Subject: [PATCH 1/3] Add option to force plot chat in plot areas. --- .../plotsquared/bukkit/listener/PlayerEvents.java | 8 ++++++-- .../main/java/com/plotsquared/core/command/Chat.java | 12 +++++++++--- .../java/com/plotsquared/core/plot/PlotArea.java | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) 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 f08ad7202..b13197be0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -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())) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Chat.java b/Core/src/main/java/com/plotsquared/core/command/Chat.java index 7048dc31e..e8c9e395c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Chat.java +++ b/Core/src/main/java/com/plotsquared/core/command/Chat.java @@ -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; } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index e4248e6f5..fcf35b783 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -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()); From 814fca3832f1a7ce4b7b54fd201b78a373ea29c2 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 16 Apr 2020 19:15:40 +0200 Subject: [PATCH 2/3] Update flag description --- Core/src/main/java/com/plotsquared/core/command/Caps.java | 3 +-- .../main/java/com/plotsquared/core/configuration/Captions.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Caps.java b/Core/src/main/java/com/plotsquared/core/command/Caps.java index 05ab6fb1b..372e415b8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Caps.java +++ b/Core/src/main/java/com/plotsquared/core/command/Caps.java @@ -46,7 +46,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; @CommandDeclaration(command = "caps", category = CommandCategory.INFO, - description = "Show plot mob caps", + description = "Show plot entity caps", usage = "/plot caps") public class Caps extends SubCommand { @@ -80,5 +80,4 @@ public class Caps extends SubCommand { .replace("%current%", Integer.toString(current)) .replace("%limit%", Integer.toString(max)).replace("%percentage%", percentage)); } - } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java index aa06e7095..8dcebcb43 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java @@ -604,7 +604,7 @@ public enum Captions implements Caption { + " set to `default` to use the gamemode default, and `false` to disable flight entirely.", "Flags"), FLAG_DESCRIPTION_UNTRUSTED("Set to `false` to disallow untrusted players from visiting the plot.", "Flags"), FLAG_DESCRIPTION_DENY_EXIT("Set to `true` to disallow players from exiting the plot.", "Flags"), - FLAG_DESCRIPTION_CHAT("Set to `false` to prevent plot chat on the plot .", "Flags"), + FLAG_DESCRIPTION_CHAT("Set to `false` to prevent plot chat on the plot.", "Flags"), FLAG_DESCRIPTION_DESCRIPTION("Plot description. Supports '&' color codes.", "Flags"), FLAG_DESCRIPTION_GREETING("Message sent to players on plot entry. Supports '&' color codes.", "Flags"), FLAG_DESCRIPTION_FAREWELL("Message sent to players when leaving the plot. Supports '&' color codes.", "Flags"), From 546c4defb742b7fd5afb7e75524bf246e054be6b Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 16 Apr 2020 23:49:08 +0200 Subject: [PATCH 3/3] Add SirYwell to authors list Thanks for all your hard work regarding v5 :heart: --- Bukkit/src/main/resources/plugin.yml | 2 +- Core/src/main/java/com/plotsquared/core/command/PluginCmd.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 83e711c92..05d2aa6e2 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ api-version: "1.13" version: "${version}" load: STARTUP description: "Easy, yet powerful Plot World generation and management." -authors: [Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault] +authors: [Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault, SirYwell] website: https://github.com/IntellectualSites/ softdepend: [Vault, PlaceholderAPI] loadbefore: [MultiWorld, Multiverse-Core] diff --git a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java index 00cb40395..c8c31f916 100644 --- a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java @@ -45,7 +45,7 @@ public class PluginCmd extends SubCommand { "$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)", PlotSquared.get().getVersion())); MainUtil.sendMessage(player, - "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault"); + "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); MainUtil.sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium());