233 Commits

Author SHA1 Message Date
Dylan K. Taylor
7ce33d9375
Migrate final remaining EnumTrait users to native enums 2023-09-08 10:34:12 +01:00
Dylan K. Taylor
31d8cc1cb5
Generate and use constants for pocketmine.yml constant names
a couple of usages of properties that no longer exist couldn't be migrated.
in addition, this revealed a couple of dead properties in the default file.

this is not an ideal solution (I'd much rather model the configs using classes and map them) but in the absence of a good and reliable library to do that, this is the next best thing.
2023-08-25 13:23:38 +01:00
Dylan K. Taylor
d1a7c1d453
Constify server.properties references 2023-08-25 12:49:39 +01:00
Dylan K. Taylor
1504fdca24
Use 'enchanting' terminology
'enchant' just didn't feel right, being a verb.
All these things pertain to the act of enchanting.

This is now also consistent with CraftingTransaction etc. The ship already sailed on EnchantInventory, which will have to be renamed at a later datte. However, that was already inconsistent with 'enchanting table', so that's the odd one out here.
2023-08-23 16:14:17 +01:00
Dylan K. Taylor
bf668c0f6c
Rename EnchantHelper related stuff
Perhaps this and EnchantOption should be called EnchantingHelper and EnchantingOption respectively. The terminology used is rather inconsistent, but 'enchantment' definitely isn't the right word here.
2023-08-23 16:07:02 +01:00
Dylan K. Taylor
f516c3c502
EnchantCommand: ensure that books are turned into enchanted book items 2023-08-15 19:10:48 +01:00
Dylan T
24d979bd08
Fixed /kill not properly killing the player under certain conditions, closes #4680 (#5919)
This occurs if the player had very high levels of Health Boost or other weird modifications.

It doesn't really make sense to apply damage modifiers to suicide anyway.

Really I'm doubtful that suicide should even be considered a damage type (perhaps we should add an EntitySuicideEvent), but that's a discussion for another time.
2023-07-19 16:33:16 +01:00
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