127 Commits

Author SHA1 Message Date
Dylan K. Taylor
fc487b17be
DumpMemoryCommand: use localized description 2023-01-12 22:10:13 +00:00
Alexey
0d31b25fba
Use str_starts_with and str_contains instead of strpos (#5482) 2022-12-30 21:41:30 +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
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
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
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
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 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
7f175b47e6
Fix CS 2022-08-25 18:19:22 +01:00
Dylan K. Taylor
0e73ffe555
CrashDump: Added JIT mode to data
this is necessary for identifying JIT-specific bugs, which, unfortunately, are very common.
2022-08-25 17:39:40 +01:00
Dylan K. Taylor
5cb77c8365
GiveCommand: fix CS 2022-08-22 00:55:17 +01:00
IvanCraft623
bf8befc40b
Remove dead comment on GiveCommand (#5241) 2022-08-22 00:49:22 +01:00
Dylan K. Taylor
d144832928
GiveCommand: limit max amount in line with vanilla 2022-08-21 21:19:16 +01:00
Dylan K. Taylor
af2babec23
GiveCommand: do not accept negative amounts 2022-08-21 20:28:39 +01:00
NoClip
e12e4e8fb8
StatusCommand: fixed output of global memory limit (#5090)
Fix incorrect "Maximum memory (manager)" output
2022-06-04 17:41:55 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
a38a5c67f1
GiveCommand: show the search term in audit message, instead of the ID
this is more useful in the longer term.
2022-05-21 15:49:17 +01:00
Dylan K. Taylor
453bf6d73b
fix build 2022-04-10 21:37:10 +01:00
Dylan K. Taylor
3353a00641
List command aliases in /help <commandName> 2022-04-10 21:32:46 +01:00
Covered123
ba05b4f024
Whitelist command now kicks non-whitelisted online players (#4774)
closes #3868
2022-03-03 18:15:21 +00:00
Dylan K. Taylor
d60dba2de0
DumpMemoryCommand: fixed memory dump dir 2022-02-20 20:39:53 +00:00
Dylan K. Taylor
2f32bd877a
Replace disallowed operators in src/command/ 2022-01-20 16:49:58 +00:00
Dylan K. Taylor
661848c5e7
fix more EOF newlines 2022-01-07 20:39:43 +00:00
Dylan K. Taylor
16fd5456aa
Merge branch 'stable' into next-minor 2021-12-18 00:39:58 +00:00
Alexey
93caf72f34
KickCommand: Add missing space
closes #4660
closes #4661
2021-12-17 21:09:14 +00:00
Matthew Jordan
a41404bd8a
Allow gamemode strings for gamemode property in server.properties (#4638)
closes #2692
2021-12-14 22:56:22 +00:00
Matthew Jordan
f8ed23cc1e
ClearCommand: Add OffHandInventory to $inventories (#4631) 2021-12-09 11:19:33 +00:00
Dylan K. Taylor
889d048ca3
Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
Matthew Jordan
3728ddbf24
ClearCommand: Cleanup logic & fix vanilla disparities (#4619) 2021-12-06 23:57:07 +00:00
ねらひかだ
4cad552909
Allow input of relative coordinates to setworldspawn command (#4575) 2021-11-14 20:07:37 +00:00
ねらひかだ
d4a382d568
Fix position of setworldspawn command (#4574)
* The world spawn position is no longer rounded

* Remove round() since the position is always int
2021-11-14 15:40:20 +00:00
Dylan T
cc4bb91fcb
Implemented IPv6 support (#4554) 2021-11-08 20:03:28 +00:00
Dylan K. Taylor
f93b5be789
Added new dynamic StringToEffectParser 2021-11-08 18:49:28 +00:00
Dylan K. Taylor
08420c2556
Added new dynamic StringToEnchantmentParser
this should be used instead of VanillaEnchantments::fromString(), because it allows registering custom aliases.
2021-11-08 18:44:15 +00:00
Dylan K. Taylor
df39a1ca07
TeleportCommand: do not hardcode world bounds 2021-11-08 17:22:01 +00:00
Dylan K. Taylor
32a34d2494
Location: change order of constructor parameters
to be consistent with Position::__construct() and Location::fromObject() (although Location::fromObject() has no choice, thanks to the anti-feature known as late static binding ...)
2021-10-29 15:43:09 +01:00
Dylan K. Taylor
c1f843a42c
GarbageCollectorCommand: fixed duplicate MB suffix 2021-10-09 23:57:36 +01:00
Dylan K. Taylor
fef8297907
GiveCommand: don't crash on bogus item NBT 2021-10-05 19:09:46 +01:00
Dylan K. Taylor
fb570970a8
Localize gamemode command errors 2021-10-02 21:22:54 +01:00
Dylan K. Taylor
30e10c38b6
Localize /help 2021-10-02 20:59:36 +01:00
Dylan K. Taylor
273aa8ab42
Drop useless usage translation strings for commands with no parameters 2021-09-11 17:06:26 +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
0f70348821
Remove noise 2021-09-07 20:31:13 +01:00
Dylan K. Taylor
e140614a63
Localize /gc 2021-08-26 15:06:43 +01:00
Dylan K. Taylor
47120022c2
Localize messages for /op and /deop 2021-08-26 13:31:19 +01:00
Colin
224d71f272
World: renamed getChunks() to getLoadedChunks() (#4393) 2021-08-23 21:23:35 +01:00
Dylan K. Taylor
22316976fa
Introduce next-generation StringToItemParser
this isn't specced up with some of the finer features of LegacyStringToItemParser such as metadata parsing, but those are still a work in progress (and probably limited to specific items like durable stuff).
The goal is to unbind these aliases from legacy internal IDs, while also providing a nice flexible way for plugins to add their own items and aliases to the existing system.

This system allows mapping a string to any item at all, irrespective of state, internal IDs, or any of that nonsense. This means it's finally possible to have stuff like lapis_lazuli and bone_meal aliases in commands.
2021-08-23 00:39:20 +01:00