Command Statistics

Command Statistics

Mod

Adds /statistics [add | query | set | store | reduce |project ] to allow OPs and datapacks to manipulate players' statistics.

Server Utility

283 downloads
1 follower
Follow Save
Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Command Statistics 0.7.3-1.20.4

Changelog

Added Project

/statistics project [ list | start | pause | stop | query | store ]

Project is a new execution mood with six further branches. It's purpose is to allow for stats acrued during a specified timeframe to be tracked seporately from stats in general without interferring with general stats nor with each other.

It accomplishes this by giving each project it's own statHandler and a directory to save it's UUID.json to.

List

/statistics project list @p

List all active and inactive project for the target players.

Success and Failure

List succeeds if it finds at least one project, active or inactive, among any the target players, and fails only if it finds exactly none.

Start

/statistics project start @p <project_name>

Start adds or activates ('unpauses') the StatHandler associated to this project to each target for whom it is not already an active project. A project once started will accrue stats overtime until it is paused or stopped.

Project Names

A project can be named almost anything which minecraft considers one word. For simplicity periods are allowed in line, but for safety, project names are sanitized during execution to swap any periods [.] to underscores [_]. Therein, the project name, "project.name" is functionally identical to the project named "project_name." They are the same project

Furthermore, the string "all" is reserved for functionality in pause and stop branches. A project cannot be named "all" and the command line /statistics project start @p all will fail.

###Success and Failure Start succeeds once it has tried to start the project to each of its targets if it succeeded in starting the project for at least one of those players. A project can only be started if it is not active. Start fails if all its targets are already active members of the project or if given an illegal project name (eg. "all")

##Pause

/statistics project pause @p <project_name>
/statistics project pause @p all

Pause adds as paused or pauses the StatHandler associated with the project name. While paused, the StatHandler is inactive, and does not accrue additional stats whenever the player's stats increase or change, but will remain available for project query and project store.

All

All is a special execution mode of pause triggered by putting the string "all" as the project_name arguement. In this special cause, rather than pausing a project for each of its' targets, pause pauses every project any of its' targets is an active in for that target. To protect this functionality, the string "all" is reserved and cannot be a project name.

Success and Failure

Pause succeeds once it has tried to pause the project for each of its targets if at least one of those targets was not an inactive member of that project, and fails otherwise.

Pause All succeds once it has tried to pause all projects for each of its targets if at least one of those targets had atleast one active project, and fails otherwise.

##Stop

/statistics project stop @p <project_name>
/statistics project stop @p all

Stop removes the StatHandler associated with the project name from both the active and inactive pools. It does not delete the project's existing stats .jsons; but those jsons stop acruing stats and stop being accessable to project query and project store.

All

All is a special execution mode of stop triggered by putting the string "all" as the project_name arguement. In this special case, rather than stopping a project for each of its' targets, stop all stops every active and inactive project any of its' targets is a part of. To protect this functionality, the string "all" is reserved and cannot be a project name.

Success and Failure

Stop succeeds once it has tried to stop the project for each of its targets if at least one of those targets was an active or inactive member of that project, and fails otherwise.

Stop All succeeds once it has tried to stop all projects for each of its targets if it stopped at least one project for at least one of those targets, and fails otherwise.

Query and Store

/statistics project query @p <project_name> <stattype> <stat>
/statistics project store @p <project_name> <stattype> <stat> <objective>

Query and Store Project Query and Project Store mimick the functionality of the general query and store execution moods, except they use the project's dedicated statHandler to look up the information, meaning that for each target, they find the stat as known to the project.

Project Add | Set | Reduce

There is currently no plan to implement Project Add Set Reduce for version 1.0; If I find a more compact way of registering the command, that might change but it's not currently planned.

Success and Failure

Query and Store succeed under the same conditions their general analogues do, except they have the additional failure condition of not finding the specified project, active or inactive, among any of their targets.

Refactoring

Record -> Store

To align with existing commands keywords, record's name has been changed to store.

Reduce is still reduce

I have not and will not be changing reduceto remove to align with existing command keywords, because I think reduce more clearly signals the purpose of the command compared to vanillas analogous "remove."

Command feedback

In this version feedback is almost completely broken. This is because I intend to completely rework it in the next alpha release. The functions still work as intended. Only their user feedback has been altered or removed.

Files

command-statistics-0.7.3-1.20.4.jar(141.24 KiB) Primary Download

Project members

Hydraheadhunter

Member

Details

Licensed CC-BY-NC-SA-4.0
Published 7 months ago
Updated 4 months ago