Skip to content

Add explicit /staffchat toggle on/off command - #51

Open
BugJuiceTV wants to merge 3 commits into
DiscordSRV:mainfrom
BugJuiceTV:main
Open

Add explicit /staffchat toggle on/off command#51
BugJuiceTV wants to merge 3 commits into
DiscordSRV:mainfrom
BugJuiceTV:main

Conversation

@BugJuiceTV

Copy link
Copy Markdown

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.

@RezzedUp RezzedUp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did AI write this?



// 1. Handle your new "toggle" command first
if (args.length >= 1 && args[0].equalsIgnoreCase("toggle")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding toggle functionality to /managestaffchat?

}
return suggestions;

return null; // Or return original list if you have other completions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire file should really remain unchanged.

Comment on lines +31 to +36
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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These things are already imported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants