Dylan T 0e5395c59b
PocketMine-MP.phar self-extraction to decompressed cache (#6217)
Because ext-phar sucks, tmp gets spammed by cache files for every thread when loading files from the phar on the fly.

Instead, we convert the `.phar` into a decompressed `.tar` in the tmp directory and require files from inside it. Surprisingly, this works because `ext-phar` supports `tar` and `zip` natively. No stream wrapper is required, as the `PocketMine.php` bootstrap loads files relative to its location, so the cache is automatically used for everything.

To be honest I would rather get rid of phars entirely, but they are still the easiest way to have PhpStorm load PocketMine-MP API information for now, and the alternatives are more complicated and inconvenient.

### Caveats
Everywhere that previously used `new Phar(Phar::running(false))` in the core code needs to be updated to use `PharData` for this to work correctly. Plugins don't need to do anything.

### Why not just use `Phar::decompressFiles()`?
This requires setting `phar.readonly` to `0`, which is a security issue. Technically, we could have used a subprocess to do this, but it just didn't seem right.

### WTF? `phar://` can be used on `tar` files???
Yup. I was just as surprised to find out that `require` works in such contexts.

### Relevant issues
- Closes #6214 

## Changes
### API changes
None.

### Behavioural changes
Server startup will be slightly slower, as the phar has to decompress and convert itself into a `.tar`. However, testing showed that this generally takes less than 200 ms, so it should be barely noticeable.

## Backwards compatibility
No BC issues.

## Tests
Locally tested and the CI will also verify
2024-03-18 16:48:17 +00:00
2024-03-13 14:59:21 +00:00
2022-03-09 16:28:38 +00:00
CS
2024-03-15 18:03:44 +00:00
2021-11-30 01:16:28 +00:00
2023-11-10 16:27:57 +00:00
2022-08-16 17:22:22 +01:00


A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP

CI GitHub release (latest SemVer) Discord
GitHub all releases GitHub release (latest by SemVer)

What is this?

PocketMine-MP is a highly customisable server software for Minecraft: Bedrock Edition, built from scratch in PHP, with over 10 years of history.

If you're looking to create a Minecraft: Bedrock server with custom functionality, look no further.

  • 🧩 Powerful plugin API - extend and customise gameplay as you see fit
  • 🗺️ Rich ecosystem and large developer community - find plugins easily and learn to develop your own
  • 🌐 Multi-world support - offer a more varied game experience to players without transferring them to other server nodes
  • 🏎️ Performance - get 100+ players onto one server (depending on hardware and plugins)
  • ⤴️ Continuously updated - new Minecraft versions are usually supported within days

PocketMine-MP is NOT a vanilla Minecraft server software.

It is poorly suited to hosting vanilla survival servers. It doesn't have many features from the vanilla game, such as vanilla world generation, redstone, mob AI, and various other things.

If you just want to play vanilla survival multiplayer, consider using the official Minecraft: Bedrock server software instead of PocketMine-MP.

If that's not an option for you, you may be able to add some of PocketMine-MP's missing features using plugins from Poggit, or write plugins to implement them yourself.

Getting Started

Community & Support

Join our Discord server to chat with other users and developers.

You can also post questions on StackOverflow under the tag pocketmine.

Developing Plugins

If you want to write your own plugins, the following resources may be useful. Don't forget you can always ask our community if you need help.

Contributing to PocketMine-MP

PocketMine-MP accepts community contributions! The following resources will be useful if you want to contribute to PocketMine-MP.

Donate

PocketMine-MP is free, but it requires a lot of time and effort from unpaid volunteers to develop. Donations enable us to keep delivering support for new versions and adding features your players love.

You can support development using the following methods:

  • Patreon
  • Bitcoin (BTC): 171u8K9e4FtU6j3e5sqNoxKUgEw9qWQdRV
  • Stellar Lumens (XLM): GAAC5WZ33HCTE3BFJFZJXONMEIBNHFLBXM2HJVAZHXXPYA3HP5XPPS7T

Thanks for your support!

Licensing information

This project is licensed under LGPL-3.0. Please see the LICENSE file for details.

pmmp/PocketMine are not affiliated with Mojang. All brands and trademarks belong to their respective owners. PocketMine-MP is not a Mojang-approved software, nor is it associated with Mojang.

Languages
PHP 99.9%