Use base64 instead of hex to display binary in some places

base64 takes less space than hex, which is beneficial for logging larger payloads.
This commit is contained in:
Dylan K. Taylor
2019-06-06 14:43:20 +01:00
parent 80f8a27094
commit eb161f8e1c
5 changed files with 8 additions and 9 deletions

View File

@ -46,7 +46,6 @@ use pocketmine\utils\Binary;
use function array_map;
use function base64_decode;
use function base64_encode;
use function bin2hex;
use function file_get_contents;
use function get_class;
use function hex2bin;
@ -874,7 +873,7 @@ class Item implements ItemIds, \JsonSerializable{
* @return string
*/
final public function __toString() : string{
return "Item " . $this->name . " (" . $this->id . ":" . ($this->hasAnyDamageValue() ? "?" : $this->meta) . ")x" . $this->count . ($this->hasCompoundTag() ? " tags:0x" . bin2hex($this->getCompoundTag()) : "");
return "Item " . $this->name . " (" . $this->id . ":" . ($this->hasAnyDamageValue() ? "?" : $this->meta) . ")x" . $this->count . ($this->hasCompoundTag() ? " tags:" . base64_encode($this->getCompoundTag()) : "");
}
/**