From 449407439a88406a263699d7778c7338a4417775 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 29 Oct 2020 13:12:26 -0700 Subject: [PATCH] Added 'Chat.Channels.Party.Spies.Automatically_Enable_Spying' which allows chat spys to join servers with spying toggled on instead of off its a QOL feature for people who are always spying on chat --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/chat/ChatManager.java | 3 +-- src/main/java/com/gmail/nossr50/config/ChatConfig.java | 5 +++++ .../java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java | 5 +++++ src/main/resources/chat.yml | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 3a323c230..e6acfb699 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Version 2.1.151 Fixed a bug where players could use the party chat command without the party chat permission Added new config 'chat.yml' + Added 'Chat.Channels.Party.Spies.Automatically_Enable_Spying' to chat.yml which when enabled will start users who have the chat spy permission in chat spying mode All chat settings that used to be in 'config.yml' are now in 'chat.yml' NOTES: diff --git a/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/src/main/java/com/gmail/nossr50/chat/ChatManager.java index a15f1cc9f..8dee40de3 100644 --- a/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -218,5 +218,4 @@ public class ChatManager { } } } -} - +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/ChatConfig.java b/src/main/java/com/gmail/nossr50/config/ChatConfig.java index f8d117288..27e57930d 100644 --- a/src/main/java/com/gmail/nossr50/config/ChatConfig.java +++ b/src/main/java/com/gmail/nossr50/config/ChatConfig.java @@ -48,4 +48,9 @@ public class ChatConfig extends AutoUpdateConfigLoader { String key = "Chat.Channels." + StringUtils.getCapitalized(chatChannel.toString()) + ".Use_Display_Names"; return config.getBoolean(key, true); } + + public boolean isSpyingAutomatic() { + return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false); + } + } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index e5f38f706..1223c9083 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.datatypes.player; import com.gmail.nossr50.chat.author.AdminAuthor; import com.gmail.nossr50.chat.author.PartyAuthor; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.config.ChatConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; @@ -161,6 +162,10 @@ public class McMMOPlayer implements Identified { this.partyAuthor = new PartyAuthor(player); this.chatChannel = ChatChannel.NONE; + + if(ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) { + chatSpy = true; + } } public String getPlayerName() { diff --git a/src/main/resources/chat.yml b/src/main/resources/chat.yml index 0aa86c7b6..b9f180922 100644 --- a/src/main/resources/chat.yml +++ b/src/main/resources/chat.yml @@ -8,6 +8,9 @@ Chat: Enable: true # Whether or not to use the current display name of a player Use_Display_Names: true + Spies: + # Whether or not players with the chat spy permission join the server with chat spying toggled on + Automatically_Enable_Spying: false Admin: # Enable or disable party chat Enable: true