AgentSkillsCN

commands

ChatControl 命令系统:包含 /chc 子命令、/channel、/tell、/reply、/ignore、/mail、/mute、/spy、/tag、/toggle、/me、/say、/motd、/list、/realname 等命令,以及权限管理与 Tab 补全功能。当您需要开发命令代码、诊断命令问题,或查询命令语法时,可使用此功能。

SKILL.md
--- frontmatter
name: commands
description: 'ChatControl command system: /chc subcommands, /channel, /tell, /reply, /ignore, /mail, /mute, /spy, /tag, /toggle, /me, /say, /motd, /list, /realname, permissions, tab completion. Use when working on command code, diagnosing command issues, or looking up command syntax.'

Command System

Overview

ChatControl registers a main /chc (ChatControl) command group with many subcommands, plus standalone commands like /tell, /channel, /mail, etc. All command aliases are configurable in settings.yml.

Architecture

Key Classes

  • ChatControlCommands (command/chatcontrol/) — main /chc command group
  • ChannelCommands (command/channel/) — /channel command group
  • SharedChatControlCommandCore — shared helper interface with lookup utilities
  • Various Command*.java files — standalone commands

Foundation Command Framework

  • SimpleCommandGroup — groups subcommands under one label
  • SimpleCommand / SimpleSubCommand — individual command implementations
  • @Permission / @PermissionGroup annotations — permission declarations

Command Reference

Main Commands

CommandClassPermissionPurpose
/tell <player> <msg>CommandTellchatcontrol.command.tellPrivate message
/reply <msg>CommandReplychatcontrol.command.replyReply to last PM
/ignore <player>CommandIgnorechatcontrol.command.ignoreIgnore player
/mailCommandMailchatcontrol.command.mailMail system
/me <msg>CommandMechatcontrol.command.me/me action message
/say <msg>CommandSaychatcontrol.command.sayBroadcast as server
/motdCommandMotdchatcontrol.command.motdShow MOTD
/listCommandListchatcontrol.command.listPlayer list
/mute <type>CommandMutechatcontrol.command.muteMute player/channel/server
/spyCommandSpychatcontrol.command.spyToggle spy mode
/tag <type>CommandTagchatcontrol.command.tagSet prefix/nick/suffix
/toggle <type>CommandTogglechatcontrol.command.toggleToggle features on/off
/realname <nick>CommandRealNamechatcontrol.command.realnameLookup real name from nick

Channel Commands (/channel)

SubcommandClassPermissionPurpose
/channel join <ch> [mode]JoinChannelSubCommandchatcontrol.channel.join.*Join channel
/channel leave <ch>LeaveChannelSubCommandchatcontrol.channel.leave.*Leave channel
/channel listListChannelSubCommandchatcontrol.channel.listList channels
/channel send <ch> <msg>SendChannelSubCommandchatcontrol.channel.send.*Send to channel
/channel sendas <ch> <player> <msg>SendAsChannelSubCommandchatcontrol.channel.sendas.*Send as player
/channel set <ch>SetChannelSubCommandchatcontrol.channel.setSet write channel

ChatControl Subcommands (/chc)

SubcommandClassPermissionPurpose
/chc announce <type> <msg>AnnounceSubCommandchatcontrol.command.announce.*Broadcast announcement
/chc book <file>BookSubCommandchatcontrol.command.bookOpen book file
/chc clear [type]ClearSubCommandchatcontrol.command.clearClear chat
/chc colorColorSubCommandchatcontrol.command.colorChat color picker
/chc convertConvertSubCommandchatcontrol.command.migrateImport from other plugins
/chc forward <cmd>ForwardSubCommandchatcontrol.command.forwardRun command on other servers
/chc info <player>InfoSubCommandchatcontrol.command.infoPlayer info panel
/chc logLogSubCommandchatcontrol.command.logView/search logs
/chc message <type> <group>MessageSubCommandchatcontrol.command.messageTest messages
/chc points <player>PointsSubCommandchatcontrol.command.pointsWarning points
/chc purge <days>PurgeSubCommandchatcontrol.command.purgePurge old data
/chc rule <action>RuleSubCommandchatcontrol.command.ruleManage rules
/chc sendformat <format>SendFormatSubCommandchatcontrol.command.sendformatTest format display
/chc tag <type> <player>TagSubCommandchatcontrol.command.tagAdmin tag management
/chc tourTourSubCommandchatcontrol.command.tourPlugin tour/tutorial
/chc reload(Foundation)chatcontrol.command.reloadReload configs
/chc debug(Foundation)chatcontrol.command.debugGenerate debug ZIP
/chc perms(Foundation)chatcontrol.command.permissionsList all permissions

Command Aliases

Configurable in settings.yml under each feature section:

yaml
Private_Messages:
  Command_Aliases: [tell, msg, pm, whisper, w]
  Reply_Aliases: [reply, r]

Helper Methods (SharedChatControlCommandCore)

Utilities for all commands:

  • findChannel(name) — lookup channel or throw error
  • findMode(name) — parse ChannelMode or throw error
  • findRule(name) — lookup rule by name
  • findRuleType(name) — parse RuleType enum
  • findRuleGroup(name) — lookup rule group
  • findMessage(type, group) — find PlayerMessage by group
  • findMessageType(name) — parse PlayerMessageType enum
  • pollDiskCacheOrSelf(name, callback) — async player cache lookup
  • pollCache(name, callback) — async lookup by name or nick

Common Issues & Solutions

"Command not found"

  1. Check command aliases in settings.yml
  2. Verify player has the permission node
  3. /chc perms lists all available permissions
  4. Other plugins may override command aliases

"Tab completion not working"

  1. ChatControl uses Foundation's tab completion system
  2. Check tabComplete() method in the command class
  3. Verify chatcontrol.bypass.tab.complete isn't interfering

"Can't tell/reply to offline player"

  • PMs require target to be online (or on proxy network)
  • Reply requires recent PM exchange (PlayerCache.replyPlayerName)

"Command conflicts with other plugins"

  • Change aliases in settings.yml to avoid conflicts
  • ChatControl registers commands at plugin load
  • Use namespaced commands: /chatcontrol:tell

Key File Paths

  • Main command group: chatcontrol-bukkit/src/main/java/org/mineacademy/chatcontrol/command/chatcontrol/
  • Channel commands: chatcontrol-bukkit/src/main/java/org/mineacademy/chatcontrol/command/channel/
  • Standalone commands: chatcontrol-bukkit/src/main/java/org/mineacademy/chatcontrol/command/
  • Shared utilities: chatcontrol-bukkit/src/main/java/org/mineacademy/chatcontrol/command/SharedChatControlCommandCore.java
  • Permissions: chatcontrol-core/src/main/java/org/mineacademy/chatcontrol/model/Permissions.java

Foundation Integration

  • SimpleCommandGroup — groups subcommands, provides help pages
  • SimpleCommand — base class with permission checks, argument parsing
  • SimpleSubCommand — subcommand with auto tab completion
  • @Permission — declares required permission