Skip to content

Commit 58f8a26

Browse files
committed
fix(core): normalize component status formatting
1 parent a2d7fc6 commit 58f8a26

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ elprobe run <package>
338338
messaging, metrics, HTTP/webhook, i18n and generic exception wrappers.
339339
These responsibilities now belong to owning plugins, focused official libs or
340340
future 3.x observability/notification layers.
341+
- Component enable/disable notices now use PocketMine `TextFormat` constants
342+
instead of raw section-sign color codes in the core component logger.
341343

342344
### Documentation
343345

changelogs/3.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,8 @@ Reload rereads config files for future EasyLibrary operations. It does not:
15301530
`camera`, `particle`, `sound`, `cooldown`, `combat`, `scheduler`,
15311531
`datastore`, `event`, `messaging`, `metrics`, `http`, `network`, `i18n` and
15321532
generic `exception`.
1533+
- Component enable/disable notices now use PocketMine `TextFormat` constants
1534+
instead of raw section-sign color codes in `LibraryComponents`.
15331535

15341536
### Why it changed
15351537

@@ -1548,6 +1550,12 @@ gameplay/player-feedback concerns. HTTP/webhook, event bus, messaging and
15481550
metrics helpers need stronger lifecycle, retry, privacy and observability
15491551
contracts before they belong in the EasyLibrary ecosystem.
15501552

1553+
The component logging polish is intentionally small but useful for the 3.x
1554+
cleanup: active core output should be generated through PocketMine formatting
1555+
APIs instead of embedded formatting bytes. This keeps console output and future
1556+
log processing easier to reason about while preserving the same visible
1557+
component status messages.
1558+
15511559
### Developer impact
15521560

15531561
Plugins should treat optional official libraries as optional providers unless

src/LibraryComponents.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use imperazim\components\plugin\PluginComponent;
99
use imperazim\library\config\ConfigDirectoryService;
1010
use imperazim\library\config\ConfigStatusService;
11+
use pocketmine\utils\TextFormat;
1112

1213
/**
1314
* Class LibraryComponents
@@ -109,7 +110,8 @@ public function enableComponents(): void {
109110

110111
if ($logger) {
111112
$this->plugin->getServer()->getLogger()->notice(
112-
"§7$componentName component " . ($enable ? "§aON" : "§cOFF")
113+
TextFormat::GRAY . "$componentName component " .
114+
($enable ? TextFormat::GREEN . "ON" : TextFormat::RED . "OFF")
113115
);
114116
}
115117
}
@@ -145,7 +147,11 @@ private function validateComponentConfig(string $componentName, mixed $enable, b
145147
$this->componentsFile->set(["vendor.$componentName" => false]);
146148
$this->plugin->getLogger()->warning("$componentName component SKIPPED: unknown, removed or deprecated component. It was disabled in " . $this->configFileLabel() . ".");
147149
} elseif ($logger) {
148-
$this->plugin->getServer()->getLogger()->notice("§7$componentName component §cOFF §8(unknown/deprecated)");
150+
$this->plugin->getServer()->getLogger()->notice(
151+
TextFormat::GRAY . "$componentName component " .
152+
TextFormat::RED . "OFF " .
153+
TextFormat::DARK_GRAY . "(unknown/deprecated)"
154+
);
149155
}
150156
return false;
151157
}

0 commit comments

Comments
 (0)