How to disable some commands while a task is running? Or if a player uses that command then the task will get disabled
When a task is started, you can add a player to an array, when the task finishes you remove the player from the array, you can use the PlayerCommandPreprocessEvent command to detect the command. When the event is called make sure the player is in the array, you can cancel the event.
Just temporarily revoke the player's permission to use that command, setting a negative value in a PermissionAttachment.
Cache what commands are blocked to which players and then check on PlayerCommandPreprocessEvent (I think thats the event name) and block them then. As for your signature, wrongo PHP is very well paying.
To revoke permission, simple type the permission with a hyphon infront, for example; -pocketmine.command.gamemode (revokes permission to change gamemode)
Using PlayerCommandPreprocessEvent should not be the best solution if there is alternative, because we don't really have a good plugin-compatibility solution on events. You're talking about using a permission manager. I think @BruhLol's talking about doing it programmatically (I'm struggling the proper third-person pronoun to use ).
That's the point. Different plugins use PlayerCommandPreprocessEvent for different reasons, and if you aren't careful enough, they'll easily clash.