Add explicit /staffchat toggle on/off command - #51
Conversation
RezzedUp
left a comment
There was a problem hiding this comment.
Thank you for the PR, however, I strongly suspect most (if not all) of the code changes here were written by AI. If this code did originate from AI, please disclose that up front.
My biggest question overall is: why did you modify /managestaffchat? That command is primarily for plugin administration and doesn't have anything to do with the functionality you're attempting to add.
As for adding a subcommand to /staffchat... that code more or less seems like it'll work, but I'm not a fan of adding extra functionality to that command since it will interfere with messaging. In this case, people won't be able to send messages starting with the word "toggle" anymore. I would prefer making a separate command (or two) for this.
| @NullOr String option = (args.length >= 1) ? args[0].toLowerCase(Locale.ROOT) : null; | ||
|
|
||
|
|
||
| // 1. Handle your new "toggle" command first |
|
|
||
|
|
||
| // 1. Handle your new "toggle" command first | ||
| if (args.length >= 1 && args[0].equalsIgnoreCase("toggle")) { |
There was a problem hiding this comment.
Why are you adding toggle functionality to /managestaffchat?
| } | ||
| return suggestions; | ||
|
|
||
| return null; // Or return original list if you have other completions |
There was a problem hiding this comment.
This entire file should really remain unchanged.
| import com.rezzedup.discordsrv.staffchat.StaffChatPlugin; | ||
| import org.bukkit.command.Command; | ||
| import org.bukkit.command.CommandExecutor; | ||
| import org.bukkit.command.CommandSender; | ||
| import org.bukkit.command.ConsoleCommandSender; | ||
| import org.bukkit.entity.Player; |
There was a problem hiding this comment.
These things are already imported.
This PR adds an explicit on/off (or yes/no) toggle feature to the /staffchat command via the toggle subcommand.
#50
Why this is needed
Previously, the /staffchat command only acted as a simple toggle, which could be confusing for staff members who wanted to ensure their status was explicitly enabled or disabled. This update provides an explicit switch to prevent accidental changes.
Changes made
Updated StaffChatCommand.java to intercept /staffchat toggle <on/off> before the main command logic processes it.
Utilized profile.automaticStaffChat(boolean) to explicitly set the user's status.
Added a return true; to ensure the toggle command does not incorrectly trigger the message-sending logic.
Testing
Verified that /staffchat toggle on and /staffchat toggle off correctly update the user's profile state.
Confirmed that these commands no longer broadcast "toggle on/off" as messages to the staff chat.