226 Commits

Author SHA1 Message Date
Dylan K. Taylor
0dca85af44
Merge branch 'minor-next' into major-next 2023-04-26 23:28:27 +01:00
Dylan K. Taylor
8102616ff4
Added ticking chunk count to /status
closes #5716
2023-04-26 17:05:31 +01:00
Dylan K. Taylor
1026811741
Merge branch 'minor-next' into major-next 2023-04-14 21:00:08 +01:00
Dylan K. Taylor
6fc4ce0f86
ÂTimingsCommand: include HTTP response code in debug message
we should probably show this in the regular response message, but we need new translations for that.
2023-04-14 16:02:27 +01:00
Dylan K. Taylor
a0dadc6e37
Merge branch 'minor-next' into major-next 2023-04-10 14:38:23 +01:00
Dylan K. Taylor
734adec90d
TimingsCommand: log the response body on failed paste 2023-04-06 14:46:02 +01:00
Dylan K. Taylor
b2f755720d
Use a proper Breakdown timing group instead of the unwieldy INCLUDED_BY_OTHER_TIMINGS_PREFIX 2023-04-05 20:47:47 +01:00
Dylan K. Taylor
948aa059c3
ÂCommand: fixed inconsistent API method name 2023-03-02 15:09:52 +00:00
Dylan K. Taylor
7611155ff9
CS 2023-02-15 15:13:12 +00:00
Dylan K. Taylor
aacd92bf08
Command: fix setPermissions docblock 2023-02-13 14:46:37 +00:00
Dylan K. Taylor
caebe14dab
Use an array for command permissions
it doesn't make sense to have to parse the string every time we want to verify permissions, nor to expect that people will somehow know to use ; to separate them without it being documented anywhere...
2023-02-13 14:44:55 +00:00
Dylan K. Taylor
cb10360c20
SimpleCommandMap: require commands to have a permission
fixes #5305
2023-02-13 14:24:30 +00:00
Dylan K. Taylor
082f9e1647
Deny permission to use a command if no permission is set
Having no permission is almost always a bug. We already have behaviour elsewhere in the core that assumes undefined permission = permission denied.

This behaviour might confuse some people, but I think it's much less dangerous than accidentally allowing everyone to use your command.
2023-02-13 14:22:36 +00:00
Dylan K. Taylor
a4494a2133
Merge branch 'next-minor' into next-major 2023-01-12 22:11:14 +00:00
Dylan K. Taylor
fc487b17be
DumpMemoryCommand: use localized description 2023-01-12 22:10:13 +00:00
BrandPVP
9c391a6809
Declare built-in command names inside the constructor (#5487)
This increases code consistency by placing the name in the same place where everything else about the command is defined.
2023-01-09 20:43:08 +00:00
Dylan K. Taylor
c2918709a3
Merge branch 'next-minor' into next-major 2023-01-06 01:59:04 +00:00
Alexey
172ce659b8
Use str_starts_with, str_ends_with and str_contains instead of strpos (#5485) 2022-12-31 13:02:23 +00:00
Alexey
0d31b25fba
Use str_starts_with and str_contains instead of strpos (#5482) 2022-12-30 21:41:30 +00:00
Dylan K. Taylor
7ac6bd79a9
Localized remaining disconnection screens (except one or two that should never actually happen) 2022-12-27 20:05:59 +00:00
Dylan K. Taylor
d37841c214
Merge branch 'next-minor' into next-major 2022-12-24 17:34:37 +00:00
Dylan T
567bd8abb5
Add .self and .other permissions for gameplay-altering commands (#5470)
I'm not quite sure this is the best way to enable such functionality, but it's already used for some other stuff, so I'm not too worried for now.

This allows the following commands to have their usage limited to self or others:
- /effect
- /enchant
- /gamemode
- /give
- /spawnpoint
- /teleport
- /title

I envision this being useful for creative mode servers, and test servers such as test.pmmp.io.
2022-12-24 17:22:18 +00:00
Dylan K. Taylor
f8cc015c51
Merge branch 'next-minor' into next-major 2022-12-23 16:58:59 +00:00
Dylan K. Taylor
5d2b0acfc8
GamemodeCommand: report failure if the target's game mode is already the desired game mode
this has irritated me for years.
2022-12-22 18:38:10 +00:00
Dylan K. Taylor
4d79aced07
Merge branch 'next-minor' into next-major 2022-12-15 19:50:27 +00:00
Dylan K. Taylor
99996b62d6
Align PhpDoc @param tags according to PHP-CS-Fixer 2022-12-06 13:21:20 +00:00
Dylan K. Taylor
b6982a84ef
Merge branch 'next-minor' into next-major 2022-11-25 14:52:56 +00:00
Dylan K. Taylor
ff2391e74a
FormattedCommandAlias: use new string for description 2022-11-15 15:26:55 +00:00
Dylan K. Taylor
01bad344a0
Merge branch 'next-minor' into next-major 2022-11-04 20:47:26 +00:00
Dylan K. Taylor
cdbdcb5d67
Merge branch 'stable' into next-minor 2022-11-04 20:44:28 +00:00
Dylan K. Taylor
bfd1b2c635
PHPStan 1.9.1 2022-11-04 18:28:07 +00:00
Dylan K. Taylor
d9638cef96
Merge branch 'next-minor' into next-major 2022-11-02 16:04:16 +00:00
Dylan K. Taylor
1671405cd0
Merge branch 'stable' into next-minor 2022-11-02 16:03:30 +00:00
Dylan K. Taylor
1572b31b8d
FormattedCommandAlias: do not fill empty strings for missing placeholder arguments
this is pretty much always going to cause unexpected behaviour, as most execute() implementations don't expect empty strings, and it can also pad the args with dummy entries, breaking argument count requirements (e.g. aliasing say  and using the alias with no arguments will confuse the target command).

Instead:
- Drop arguments that cannot be resolved (leave them unspecified)
- If they are at the end of the argument sequence, this is OK - it will behave the same as if some optional arguments weren't specified.
- If they are in the middle of the argument sequence, this will generate an error - this is preferable to having the target invoked with an empty string, which might cause unexpected behaviour.

fixes #5379
2022-11-02 15:02:29 +00:00
Dylan K. Taylor
fba4895a17
Merge branch 'next-minor' into next-major 2022-10-31 19:11:39 +00:00
Dylan K. Taylor
b6f6671a81
Merge branch 'stable' into next-minor 2022-10-31 15:34:24 +00:00
Eren A. Akyol
fb31e6085e
StatusCommand: fix condition order for TPS colour (#5366) 2022-10-26 23:26:55 +01:00
Dylan K. Taylor
d74824c8d5
Correctly use Command->getLabel() instead of Command->getName()
getName() essentially serves as an ID for the command for CommandExecutors. It has no other sane use case.

Since it's not unique (multiple commands with the same name may be registered, and the fallback alias will be used on conflict), it cannot be used for array indexing. It's also not correct to use it for any display purpose, since the command may not be able to be invoked by its 'name' if there was a conflict.

There is an open debate about what to do with getName() and the wider CommandExecutor ecosystem, but that's a topic for another discussion.

closes #5344
2022-10-18 19:34:12 +01:00
Dylan K. Taylor
bd01a919e5
Move command timings to Timings::
this avoids duplicate timings entries when command labels are changed and changed back, or if multiple command maps are in use.
In addition, it also solves some PHPStan issues :)
2022-10-16 16:57:10 +01:00
Dylan K. Taylor
7bcc663b60
Migrate core code to using symfony/filesystem
webmozart/path-util is retained for plugin compatibility, but is dropped in 5.0
2022-10-14 21:51:29 +01:00
Dylan K. Taylor
f88ae93897
BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332 2022-10-13 16:43:36 +01:00
Dylan K. Taylor
1c6a2b66f7
Merge remote-tracking branch 'origin/next-minor' into next-major 2022-09-29 22:38:26 +01:00
Dylan K. Taylor
0c7f8470b9
Avoid repeated strtolower usages in a couple of places 2022-09-28 21:30:06 +01:00
Dylan K. Taylor
4b41b2f9ae
Merge remote-tracking branch 'origin/next-minor' into next-major 2022-09-28 16:15:35 +01:00
Dylan T
b87e4d8bd3
Introduce and use TextFormat::addBase() (#5268)
This function adds "base" format to a string. The given formats are inserted directly after any RESET code in the sequence.

An example of where this is needed is in the logger.

Without this change, the following code:
$logger->notice("I'm a " . TextFormat::RED . "special" . TextFormat::RESET . " cookie");

causes the "cookie" part of the message to show as grey, instead of the expected aqua for NOTICE level messages.

There are also many workarounds for this problem throughout the server, mostly in command outputs, being forced to use WHITE instead of RESET to avoid breaking the logger output.
2022-09-28 16:13:11 +01:00
Dylan K. Taylor
6f4ea886b0
Merge branch 'next-minor' into next-major 2022-09-28 00:39:00 +01:00
Dylan K. Taylor
cfb0cad7e0
Console commands now write to stdout directly, instead of being fed through the logger
this has a number of implications:
- Console command outputs are now (obviously) not logged. This is consistent with every other type of command sender, be it RCON, players, or anything else.
- The assumption that the console command sender must be able to see the logger output is now broken, since the command sender can receive output separately from the logs.

In the future, it might be desirable to send the console command output to stderr instead of stdout, so that stdout can be silenced while still allowing commands to be used.

closes #2543
2022-09-27 21:03:03 +01:00
Dylan T
83e5b0adb6
ConsoleCommandSender is no longer responsible for forwarding broadcast messages to the logger (#5311)
This is a step towards implementing #2543.
2022-09-27 20:58:33 +01:00
Dylan K. Taylor
d4c4ae3d7a
Merge branch 'next-minor' into next-major 2022-08-25 19:27:29 +01:00
Dylan K. Taylor
7f175b47e6
Fix CS 2022-08-25 18:19:22 +01:00