PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

feat(Server): add a setter for `maxPlayers`

Open cooldogedev opened this issue 1 year ago • 4 comments

Introduction

This PR allows plugins to modify the server's max players count during runtime

Relevant issues

Changes

API changes

Added Server::setMaxPlayers(int $maxPlayers): void

Behavioural changes

Backwards compatibility

Follow-up

Tests

I tested this PR by doing the following (tick all that apply):

  • [ ] Writing PHPUnit tests (commit these in the tests/phpunit folder)
  • [x] Playtesting using a Minecraft client (provide screenshots or a video)
  • [x] Writing a test plugin (provide the code and sample output)
  • [ ] Other (provide details)

cooldogedev avatar Feb 19 '24 16:02 cooldogedev

note that this is a BC break, e.g. for plugins that do a SplFixedArray($server->getMaxPlayers())

SOF3 avatar Feb 21 '24 07:02 SOF3

does anyone do that?

dktapps avatar Feb 21 '24 17:02 dktapps

there is no bc break because there is no such plugins that call setMaxPlayers()

BrandPVP avatar Feb 22 '24 05:02 BrandPVP

rip i was about to make a pr doing this too 🙏

Wraith0x10 avatar Feb 22 '24 11:02 Wraith0x10