Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/luca28pet/precisecpscounter

A PocketMine-MP plugin that measures CPS (clicks per second)
https://github.com/luca28pet/precisecpscounter

pocketmine pocketmine-mp pocketmine-mp-plugin pocketmine-plugin

Last synced: about 1 month ago
JSON representation

A PocketMine-MP plugin that measures CPS (clicks per second)

Awesome Lists containing this project

README

        

# PreciseCpsCounter
Latest development phars: https://poggit.pmmp.io/ci/luca28pet/PreciseCpsCounter

ScoreHud addon: https://gist.github.com/luca28pet/34ae893290041a8d238860c5c91b4a60

**PreciseCpsCounter** is an API that can measure the CPS (clicks per second) of a player (all left clicks are taken into account).
You can use PreciseCpsCounter from other plugins to get the CPS of a player using the public function getCps:

`public function getCps(Player $player, float $deltaTime = 1.0, int $roundPrecision = 1) : float;`

An example of how you can use this plugin:

- Sending the CPS in a popup every second.
```
$this->getScheduler()->scheduleRepeatingTask(new ClosureTask(function() : void{
foreach($this->getServer()->getOnlinePlayers() as $p){
$p->sendPopup('CPS: '.$this->getCps($p));
}
}), 20);
```

Apparently, it does not work with CPSs greater than 30.

## Known Issues
**Incorrect CPS measurement when hitting blocks**
If a click is well-timed and you manage to initiate the breaking of 2 (or more) blocks with one click, it will result as 2+ clicks because the client sends two PlayerActionPackets.
You can workaround this by disabling count-left-click-on-block in the config.yml file, but it will not take into account any left click on blocks.