Commit Graph

14985 Commits

Author SHA1 Message Date
9195c88670 ConsoleReader: Use proc_open()'s socket support to send commands back to the main server process (#5273)
Support for this was introduced in PHP 8.0, though not mentioned in any changelog: php/php-src#5777

This simplifies the subprocess handling considerably. However, there is a potential for problems if PHP generates any E_* errors, since these get written to STDOUT as well.
To avoid error messages being treated as a command, a hash is attached to each IPC message, seeded with an incrementing counter. This prevents error messages causing command replays or unintended commands.

Unfortunately, PHP doesn't support binding pipes other than stdin/stdout/stderr on Windows for the child process, so we have to use stdout for this. In the future, if it becomes possible, a dedicated pipe for the purpose should be introduced. We'd need something like php://fd/<number> to work on Windows.
2024-11-20 14:56:52 +00:00
ae19d05fd5 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11924942897
2024-11-20 01:27:30 +00:00
e710b3750f Adjust pretty name of closures on PHP 8.4 (#6351)
related to https://github.com/php/php-src/pull/13550

see analog symfony change: https://github.com/symfony/symfony/pull/54614
2024-11-19 17:05:21 +00:00
8ccd1edb17 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11904511045
2024-11-19 01:36:11 +00:00
faf1e26bac Fix: implicitly nullable parameter declarations deprecated (#6522) 2024-11-18 23:54:22 +00:00
1555fa17e7 Added ability to pick end crystal item (#6509) 2024-11-16 19:06:03 +00:00
e77f2c5198 Implemented End Crystal (#4715)
Co-authored-by: Dylan T. <dktapps@pmmp.io>
2024-11-16 17:57:57 +00:00
d3add78d3e Add support for basic entity picking via middle-click (#5397)
Support for more advanced stuff like NBT copying wasn't added in this PR, as the NBT used by PM is currently an inconsistent mess and doesn't play nice with vanilla. In the interests of avoiding this mess propagating, it's been left for another time.

Adds PlayerEntityPickEvent a la PlayerBlockPickEvent
and Entity->getPickedItem().
2024-11-15 21:27:10 +00:00
ff695a5f97 PlayerInteractEvent: added APIs to independently control reaction of item and block (#4683)
This allows, for example, banning the usage of spawn eggs, without preventing opening of doors, without the need for item ID whitelists.

It also allows customizing the behaviour of item and block interactions when sneaking - it's now possible to force spawn eggs to work when sneaking, or force containers to open.

Finally, this also allows preventing any interaction at all without preventing block placement (by setting both to false). Since cancelling the event will typically prevent placement too (which might not be desired).

Side note: Blocks are now always synced when right-clicking on a block.
This differs from the previous behaviour, where the blocks were only synced when the action "failed".
However, since this change introduces a situation where the action may succeed but have different results than the client expects, it's best to just always sync blocks in this situation.

Fixes #3267
2024-11-15 21:19:54 +00:00
fb1213e964 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11862895039
2024-11-15 20:21:32 +00:00
8474eaf5f1 Adjust Sugar Cane to break when there is no water (#6486) 2024-11-15 16:27:27 +00:00
a75d4687ce Implemented vanilla /xp command (#6429) 2024-11-15 16:09:55 +00:00
0b0c425805 Extract glow lichen multi face logic into traits (#6396)
This will be useful for future block additions
2024-11-15 15:47:26 +00:00
b5469dede2 Flowable blocks now can't be placed inside liquid (#5392) 2024-11-15 00:10:43 +00:00
e0d270a870 Merge branch 'minor-next' of github.com:pmmp/PocketMine-MP into minor-next 2024-11-14 23:14:33 +00:00
2d9cee3d62 Update Language dependency 2024-11-14 23:14:23 +00:00
ed64231c57 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into minor-next 2024-11-14 23:12:26 +00:00
33a7b46329 Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems (#6498)
Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems

Since BlockTypeIds and ItemTypeIds are derived from VanillaBlocks and VanillaItems respectively anyway (they only exist to allow identifying blocks/items without having to create instances of them), this hack is probably OK, and reduces the chances of mistakes.
Previously it was explored to have these IDs generated by auto-incrementing in VanillaBlocks/Items and have the constants generated that way, but this proved to be too problematic because of unstable diffs no matter how we chose to sort the elements. See #6313 for previous research on the subject.

This is obviously not a desirable hack to keep long-term. In the future it will probably make sense to redesign VanillaBlocks like so:

enum VanillaBlocks { ... }
VanillaBlocks::STONE (the type ID)
VanillaBlocks::STONE->new() (to create a block)

However, more research is needed on this, as I'd prefer not to make block creation any more verbose.
2024-11-14 17:32:22 +00:00
9b58d35516 Implement Goat horns (#5232)
Co-authored-by: ipad54 <63200545+ipad54@users.noreply.github.com>
Co-authored-by: Dylan T. <dktapps@pmmp.io>
2024-11-14 13:57:07 +00:00
3629ee7e7b Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11824307499
2024-11-13 19:21:16 +00:00
fbeb017670 Promise: allow zero promises
not supporting this has caused problems every time this function has been used in reality so far (#6092 and #6333).
2024-11-13 14:55:14 +00:00
09bf203267 Update RuntimeDataDescriber.php 2024-11-12 22:57:14 +00:00
f3cc4a28e1 Easy wins for PHPStan 2.0 support 2024-11-12 22:12:54 +00:00
3586bc42a9 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11802296296
2024-11-12 17:14:24 +00:00
07d5046b83 5.21.2 is next
Commit created by: https://github.com/pmmp/RestrictedActions/actions/runs/11796630402
2024-11-12 11:48:59 +00:00
4a702b97fd Prepare 5.21.1 release (#6493) 2024-11-12 11:48:01 +00:00
d2c3b8dacb Fix GC cycle count increases on player disconnect (#6487) 2024-11-11 16:10:19 +01:00
fa3529966f Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11769186885
2024-11-10 22:56:08 +00:00
2ff6470792 Fixed server crash when applying item cooldown (#6491)
This commit fixes server crash when applying a cooldown to any item which count is equals to 1.

closes #6490 
closes #6488
2024-11-10 19:15:30 +00:00
05a9e9c76e Implemented sound when drinking a potion (#6444) 2024-11-10 15:07:18 +00:00
231eec911f Enchanted Golden Apple: Regeneration 5 => 2 matching Java (#6445) 2024-11-09 19:43:30 +00:00
8c04d47b1b Make weakness effect only applicable for melee damage (#6489) 2024-11-09 19:18:30 +00:00
e598364f06 5.21.1 is next
Commit created by: https://github.com/pmmp/RestrictedActions/actions/runs/11652565588
2024-11-03 15:30:16 +00:00
96b12bddc1 Prepare 5.21.0 release 2024-11-03 15:24:43 +00:00
c63d0ef1b6 Fix dodgy ignored PHPStan error 2024-11-03 14:43:34 +00:00
9e19391f20 Merge branch 'minor-next' into blockstate-schema-generator-improvements 2024-11-03 14:06:57 +00:00
c0b74b0341 Update BlockStateUpgrader.php 2024-11-03 14:05:46 +00:00
3c96e72f7d Merge remote-tracking branch 'origin/stable' into minor-next 2024-11-03 14:01:47 +00:00
0376e37966 5.20.2 is next
Commit created by: https://github.com/pmmp/RestrictedActions/actions/runs/11614028030
2024-10-31 14:38:30 +00:00
94dff74494 Prepare 5.20.1 release (#6479) 2024-10-31 14:35:42 +00:00
8ef5e737de Temporary resolve loading old skulls from storage (#6476) 2024-10-27 01:29:34 +01:00
e7d8d99ca6 5.20.1 is next 2024-10-26 15:42:43 +01:00
414e8acf8c Release 5.20.0 2024-10-26 15:42:43 +01:00
4814db4fe7 Assemble 1.21.40 (#6471) 2024-10-25 14:21:51 +01:00
847f931660 Merge branch 'minor-next' into blockstate-schema-generator-improvements 2024-10-24 17:46:57 +01:00
22718c4971 Add support for specialized flattenedProperties in schema format 2024-10-24 16:12:28 +01:00
7e343617b9 Rename ICopper to CopperMaterial (#6470) 2024-10-23 11:34:42 +01:00
d945cbf517 Merge remote-tracking branch 'origin/minor-next' into blockstate-schema-generator-improvements 2024-10-17 21:00:11 +01:00
3ef7001d8e Merge branch 'stable' into blockstate-schema-generator-improvements 2024-10-17 20:55:34 +01:00
f6e6f15c63 Implemented a proper way to handle items cooldown (#6405) 2024-09-25 13:28:17 -05:00