From e97bc25fb88fa69b5b7e4e2244075f3a32ff1f93 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 17 May 2021 10:35:09 +0200 Subject: [PATCH] Log plot chat to console - Fix plot music removal template - Fix debug args --- .../bukkit/listener/PlayerEventListener.java | 10 ++++++++-- .../main/java/com/plotsquared/core/command/Debug.java | 2 +- .../main/java/com/plotsquared/core/command/Music.java | 5 +++-- .../com/plotsquared/core/configuration/Settings.java | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 36074908c..b9eb1fcd7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -40,6 +40,7 @@ import com.plotsquared.core.listener.PlayerBlockEventType; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.location.Location; import com.plotsquared.core.permissions.Permission; +import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.MetaDataAccess; import com.plotsquared.core.player.PlayerMetaDataKeys; import com.plotsquared.core.player.PlotPlayer; @@ -725,8 +726,13 @@ public class PlayerEventListener extends PlotListener implements Listener { player.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate); } } - // TODO: Re-implement - // PlotSquared.debug(full); + if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) { + Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); + Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); + Template spysenderTemplate = Template.of("sender", sender); + Template spymessageTemplate = Template.of("msg", Component.text(message)); + ConsolePlayer.getConsole().sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate); + } } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java index cde04ad76..56d7f20bb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -79,7 +79,7 @@ public class Debug extends SubCommand { if (args.length == 0) { player.sendMessage( TranslatableCaption.of("commandconfig.command_syntax"), - Template.of("value", "/plot debug ") + Template.of("value", "/plot debug ") ); } if (args.length > 0) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Music.java b/Core/src/main/java/com/plotsquared/core/command/Music.java index bf91c6958..698ec023c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -104,8 +104,9 @@ public class Music extends SubCommand { return true; } plot.removeFlag(event.getFlag()); - getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", - String.valueOf(event.getFlag()) + getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"), + Template.of("flag", String.valueOf(event.getFlag())), + Template.of("value", String.valueOf(event.getFlag().getValue()) )); } else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) { PlotFlag plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index b22546408..b7609a33b 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -509,6 +509,9 @@ public class Settings extends Config { @Comment("Should the chat be interactive?") public static boolean INTERACTIVE = true; + @Comment("Should the plot chat be logged to console?") + public static boolean LOG_PLOTCHAT_TO_CONSOLE = true; + }