Skip to content

Commit fcf4e5b

Browse files
committed
refactor(core): remove unsafe legacy utils
1 parent 10013d4 commit fcf4e5b

6 files changed

Lines changed: 40 additions & 118 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,13 @@ elprobe run <package>
347347
`PluginCdnResourcePackTrait` and `components\utils\ResourcePacks`.
348348
Resource-pack support should return later as a focused assets/resource-pack
349349
library such as `LibAssets`, not as part of `LibCommons`.
350+
- Removed unused `HttpUtils` and `FunctionUtils` helpers from
351+
`components\utils`. HTTP should move to future async `LibHttp`; delayed
352+
callbacks should use PocketMine scheduler or plugin-owned services.
350353
- `imperazim\components\filesystem\File` no longer depends on the removed
351354
Config wrapper; pass a directory string or use PocketMine `Config` directly.
355+
- `File`, `Path`, `FileExtensionTypes` and `FileSystemException` remain part of
356+
the core filesystem direction and will be hardened rather than removed.
352357
- Component enable/disable notices now use PocketMine `TextFormat` constants
353358
instead of raw section-sign color codes in the core component logger.
354359

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ move it to a future dedicated assets/resource-pack package such as `LibAssets`
222222
if the ecosystem needs one later. This does not belong in `LibCommons`, because
223223
resource packs require PocketMine lifecycle, files, manifests and server state.
224224

225+
The old `HttpUtils` and `FunctionUtils` helpers were removed from
226+
`components\utils`. Use a future async `LibHttp` for HTTP work and PocketMine's
227+
scheduler or plugin-owned services for delayed callbacks. The `File` filesystem
228+
utility remains part of the EasyLibrary core direction and will be refined
229+
rather than removed.
230+
225231
Use each standalone repository for complete API documentation and examples.
226232

227233
## Package and standalone modes

changelogs/3.0.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,9 +1538,13 @@ Reload rereads config files for future EasyLibrary operations. It does not:
15381538
registration were removed from the active core:
15391539
`PluginLanguageTrait`, `PluginResourcePacksTrait`,
15401540
`PluginCdnResourcePackTrait` and `components\utils\ResourcePacks`.
1541+
- The unused `HttpUtils` and `FunctionUtils` helpers were removed from
1542+
`components\utils`.
15411543
- `imperazim\components\filesystem\File` no longer depends on the removed
15421544
Config wrapper. New code should pass a directory string and file metadata, or
15431545
use PocketMine `Config` directly for normal config files.
1546+
- `File`, `Path`, `FileExtensionTypes` and `FileSystemException` remain part of
1547+
the core filesystem direction and will be hardened rather than removed.
15441548
- Component enable/disable notices now use PocketMine `TextFormat` constants
15451549
instead of raw section-sign color codes in `LibraryComponents`.
15461550

@@ -1581,6 +1585,17 @@ manifest validation, zip packaging, checksums, local registration and optional
15811585
CDN integration. It should not be part of `LibCommons`, because resource packs
15821586
need PocketMine lifecycle, filesystem state and server resource-pack handling.
15831587

1588+
`HttpUtils` was removed because it performed synchronous HTTP through
1589+
`file_get_contents`, which is not a good fit for PocketMine's main thread.
1590+
`FunctionUtils` was removed because it was a global helper bound to
1591+
`Library::getInstance()` and scheduler state, not a pure utility. Future HTTP
1592+
work belongs in `LibHttp`; delayed callbacks should use PocketMine scheduler or
1593+
a plugin-owned service.
1594+
1595+
The filesystem area is different: `File` and `Path` are actively useful to the
1596+
core and remain part of the EasyLibrary direction. They may be renamed, moved or
1597+
hardened, but the idea should stay available.
1598+
15841599
The component logging polish is intentionally small but useful for the 3.x
15851600
cleanup: active core output should be generated through PocketMine formatting
15861601
APIs instead of embedded formatting bytes. This keeps console output and future
@@ -1630,6 +1645,14 @@ $config = new Config($this->getDataFolder() . "settings.yml", Config::YAML, [
16301645
]);
16311646
```
16321647

1648+
If old code used `HttpUtils`, move the HTTP call into your plugin for now and
1649+
avoid blocking the main thread. If old code used `FunctionUtils`, schedule the
1650+
task through the plugin scheduler directly:
1651+
1652+
```php
1653+
$this->getScheduler()->scheduleDelayedTask($task, 20);
1654+
```
1655+
16331656
Recommended mindset:
16341657

16351658
```text

docs/migration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,18 @@ Removed 2.x-era helpers:
9292
| `imperazim\components\plugin\traits\PluginResourcePacksTrait` | Plugin-owned resource-pack bootstrapping or future `LibAssets` |
9393
| `imperazim\components\plugin\traits\PluginCdnResourcePackTrait` | Plugin-owned CDN/resource-pack integration or future `LibAssets` + `LibHttp` |
9494
| `imperazim\components\utils\ResourcePacks` | Plugin-owned resource-pack registration or future `LibAssets` |
95+
| `imperazim\components\utils\HttpUtils` | Future async `LibHttp` or plugin-owned HTTP client |
96+
| `imperazim\components\utils\FunctionUtils` | PocketMine scheduler directly or plugin-owned service |
9597

9698
The old `File` constructor no longer accepts the removed
9799
`imperazim\components\config\Config` wrapper. Pass a directory string and file
98100
metadata explicitly, or use PocketMine `Config` directly when you need a normal
99101
configuration file.
100102

103+
The `File`/`Path` filesystem direction is not being removed. It remains a core
104+
utility area and may be renamed, moved or hardened later, but the API idea stays
105+
part of the EasyLibrary ecosystem.
106+
101107
The removed resource-pack helpers used PocketMine internals and reflection.
102108
Do not depend on EasyLibrary core for that behavior in 3.x; keep resource-pack
103109
registration explicit in the plugin that owns the pack until a focused API is

src/imperazim/components/utils/FunctionUtils.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/imperazim/components/utils/HttpUtils.php

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)