28 Commits

Author SHA1 Message Date
Dylan K. Taylor
083a35f970
Modernize property type declarations 2022-06-04 18:16:32 +01:00
Dylan K. Taylor
dca457b1e0
Modernize property declarations in pocketmine\command namespace 2022-04-25 13:09:14 +01:00
Dylan K. Taylor
2f32bd877a
Replace disallowed operators in src/command/ 2022-01-20 16:49:58 +00:00
Dylan K. Taylor
ccc881ee58
Switch to custom permission denied message
closes #4494
2021-10-09 00:57:15 +01:00
Dylan K. Taylor
3b7580688c
Stop auto-translating string descriptions/usages for commands
Require usage of Translatable for translations.
2021-09-11 16:46:40 +01:00
Dylan K. Taylor
789a669395
Rename TranslationContainer -> Translatable 2021-08-15 16:17:46 +01:00
Dylan K. Taylor
db90b40bdd
Command: remove unnecessary branching in broadcastCommandMessage()
this problem is handled automatically now that nested translations are supported.
2021-08-15 16:00:16 +01:00
Dylan K. Taylor
804d02b086
TranslationContainer: added prefix(), postfix() and format() 2021-08-14 16:08:22 +01:00
Dylan K. Taylor
d30371be11
Command: Assume that TranslationContainer->getText() returns a valid translation key
there's no reason for it not to be.
2021-08-12 23:31:37 +01:00
Dylan K. Taylor
b4c0ddd155
Use native union types for TranslationContainer|string 2021-08-10 15:17:26 +01:00
Dylan K. Taylor
2293bd948d
Added KnownTranslationFactory and use it in as many places as possible
this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
2021-08-10 14:50:40 +01:00
Dylan K. Taylor
71c6f69fd3
Command: standardise permission checking
if subcommands had different permissions, the permissionMessage would not be used.
2021-08-04 20:29:07 +01:00
Dylan K. Taylor
94e16f416d
Added KnownTranslationKeys (generated) and start using it 2021-06-29 22:46:04 +01:00
Dylan K. Taylor
a70bd115f1
Moved console-specific stuff to its own namespace
this stuff has different functionality than everything else in the
command namespace (specifically console handling), so it doesn't belong
in here.

I know that this will probably break some plugins, but I don't care,
because plugins shouldn't have been abusing ConsoleCommandSender in the
first place.
2021-06-26 19:24:46 +01:00
Dylan K. Taylor
5197707d32 Separated TimingsRecord from TimingsHandler (different lifetimes)
this fixes #3906.
TimingsHandler will now be automatically destroyed when there are no TimingsRecord referencing it and its owner has no references left to it.
TimingsRecord will be automatically destroyed at the end of the timings session (if active).

This fixes records from temporary timers being lost after the timings handlers are removed, while also fixing TimingsHandlers piling up regardless of whether timings are running or not.
This opens the doors to have more volatile timers, such as per-player/per-session timers, which are destroyed on player quit, but which won't result in the timings disappearing from the final timings result.
2020-12-03 15:45:49 +00:00
Dylan K. Taylor
dd200ca8cd Rewrite message broadcasting system to not depend on PermissionManager subscriptions
relying on permission subscriptions for this was unreliable (a permissible is not always subscribed to a permission even when it does have it), and also difficult to control (for example there have been various bugs in the past where a Player ended up subscribed to broadcast permissions when it didn't expect to be, thanks to permission recalculation happening too early).
In addition, we might in the future want to have broadcast receivers which are not permissibles (i.e. a more general interface than CommandSender (why does a broadcast receiver need to also be a command sender, anyway?)), which the permission system wouldn't be suitable for.
2020-11-28 19:28:47 +00:00
Dylan K. Taylor
92f6967665 Command: validate permissions, require permission registration in advance of commands using them
this fixes #3200.
This causes permissions to be registered before plugin load, which changes some behaviour, but after discussions on #internals-dev we couldn't see any reason to keep the behaviour the way it was, and several reasons to change it to be something like this.
2020-07-08 13:50:38 +01:00
Dylan K. Taylor
52fd1a8c1d CommandSender: export getLanguage()
this currently serves as a proxy to the server main language, but it can be used by third party implementations to choose a non-Server language.
2020-06-22 20:05:23 +01:00
Dylan K. Taylor
3473254d01 added Timings::INCLUDED_BY_OTHER_TIMINGS constant 2020-05-24 16:09:45 +01:00
Dylan K. Taylor
e8bb6b8625 Command: fix output translation regression caused by 4c51f1dda348d9d1c53c89185ceeb909a1cad21a 2020-02-10 11:42:21 +00:00
Dylan K. Taylor
4c51f1dda3 Scrap TextContainer, make TranslationContainer immutable
TextContainer provided zero real value as a base of TranslationContainer, given that it required its own logic to be handled wherever accepted. As such, it's no better than a simple string.
Removing it also allows fixing an ambiguity when embedding translations inside other translations, allowing it to be made immutable.
2020-02-08 13:38:27 +00:00
Dylan K. Taylor
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
Dylan K. Taylor
25ead18369 Merge commit '7ce6c8aa13bd1e8eb5aa3fe267a0116ab43e9313' 2020-01-31 18:55:49 +00:00
Dylan K. Taylor
cd55cdf5c6 Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495' 2020-01-22 15:04:06 +00:00
Dylan K. Taylor
1b33143f4f pass 2, manual removal of incorrect non-nullable phpdoc types 2020-01-22 12:06:47 +00:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
d3d7709ead Merge branch 'next-minor' 2019-12-03 11:55:45 +00:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00