Advanced (4.xx)

Notice

please note that this documentation relates only to versions 4x. It's not relevant to new versions.

Outline

Every time a command is executed, or a sign is changed, Commandspy iterates through every player, and tries to match each rule in each group in order, until it's successful. Rules can match against an event type, sign contents, a command, against attributes of the sender (the user who caused the event), or the candidate (the user being considered). Based on the matched rule's effect, the event will be either included or excluded for the candidate. If no rule matches, defaultEffect in the config will be considered the effect.

Commands

Commandspy's subcommands can be accessed through /commandspy, or through the aliases: /c, /cs and /cspy (Please note that other plugins may provide aliases conflicting with the first two).

Subcommand Aliases Arguments Description
group g, gr <ID> ... Access a group's subcommands
groups   (User ID) List all rule groups, optionally for those matching the provided user identifier
move m, mv <ID> <ID> Order the first group before the second
new n, +, a   Create a new rule group
remove -, rm, r <ID> Remove the specified group
rules ls (User ID) List all groups, with rules, optionally for those matching the provided user identifier
swap s <ID> <ID> Swap the first and second group's positions
config cfg ... Access configuration subcommands
save     Save configuration to file
version   v, --version Reports the current version of Commandspy

For Group IDs in the above commands, you can either use the numeric ID of a group (use /cs groups if you're unsure, and /cs new if you don't have any), or one of the following:

- Absolute first group
+ Absolute last group
\ First group owned by user
~ Last group owned by user

Group commands

For /cs group n, there are the following subcommands:

Subcommand Aliases Arguments Description
add a, + <effect> <match> <flags> (pattern) Append a new rule to this group
move m, mv <n> <n> Move the first rule before the second
remove r, rm <n> Remove the rule
swap s <n> <n> Swap rule positions
own o <User ID> Set the group owner

Rule effects

RETURN r Do not continue matching against this group
EXCLUDE e Don't continue matching. Don't notify the candidate
INCLUDE i Don't continue matching. Notify the candidate

Rule match

Full Short Regex? Description
NOTHING not No Matches nothing
IS_SIGN eis No Matches if this is a sign event
IS_COMMAND eic No Matches if this is a command event
IS_CHAT eic No Matches if this is a chat event
MESSAGE m Yes Contents of the message. Player commands do not have a leading slash, sign lines are concatenated
COMMAND c Yes The initial command if the message is a command
COMMAND_ARGS Yes a The remainder of the line after the command itself
COMMAND_IS_VALID ic No Does the command in question actually exist?
LINE_0 l0 Yes First line on a sign
LINE_1 l1 Yes Second line on a sign
LINE_2 l2 Yes Third line on a sign
LINE_3 l3 Yes Fourth line on a sign
SENDER_IS_PLAYER sip No Matches if the entity which triggered this event is a player
SENDER_HOST sh Yes Matches the host of an entity (console is always ::1)
SENDER_NAME sn Yes Matches sender's username"
SENDER_IDENTIFIER sid Yes Matches by UUID for players or by name for non-players"
SENDER_HAS_PERMISSION sp No Matches if the sender has the specified permission
CANDIDATE_IS_PLAYER cip No Matches if the candidate is a player
CANDIDATE_HOST ch Yes Matches the host of a candidate (console is always ::1)
CANDIDATE_NAME cn Yes Matches candidate username
CANDIDATE_IDENTIFIER cid Yes Matches by UUID for players or by name for non-players
CANDIDATE_HAS_PERMISSION cp No Matches the host of a candidate

Rule flags

Flag Purpose Description
s Sticky Sticky rules should not be modified by 'normal' users. By default, they're used with default rules to ensure that groups are only processed by the relevant user.
r Regex Match the pattern as a JRE regular expression (Comparable to PCRE). Note that these are not available for some matching criteria (and if so, this flag will be disregarded and unset)
! Negate The effect will only be applied if the pattern does not match.
- Placeholder Use this if you don't want to set any flags

Examples

With default configuration, to be notified of commands and sign changes:

/cs new
/cs group ~ add i eic -
/cs group ~ add i eis -