Replaced hardcoded record.nowPlaying with KnownTranslationKeys

This commit is contained in:
Dylan K. Taylor 2023-01-13 17:27:57 +00:00
parent dff3f45d22
commit a9f06fc5f4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
5 changed files with 17 additions and 9 deletions

View File

@ -41,7 +41,7 @@
"pocketmine/classloader": "^0.2.0", "pocketmine/classloader": "^0.2.0",
"pocketmine/color": "^0.3.0", "pocketmine/color": "^0.3.0",
"pocketmine/errorhandler": "^0.6.0", "pocketmine/errorhandler": "^0.6.0",
"pocketmine/locale-data": "~2.16.0", "pocketmine/locale-data": "~2.17.0",
"pocketmine/log": "^0.4.0", "pocketmine/log": "^0.4.0",
"pocketmine/log-pthreads": "^0.4.0", "pocketmine/log-pthreads": "^0.4.0",
"pocketmine/math": "^0.4.0", "pocketmine/math": "^0.4.0",

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "ed6e310514b168db7eef4ae5d84c8baf", "content-hash": "b96f3344335da3824bd4640210c9499e",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -537,16 +537,16 @@
}, },
{ {
"name": "pocketmine/locale-data", "name": "pocketmine/locale-data",
"version": "2.16.0", "version": "2.17.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/Language.git", "url": "https://github.com/pmmp/Language.git",
"reference": "b3bf9029c112414fdb7cd9de778df191565d3038" "reference": "a2c7071117c98ccc0e333994271cab1072eb3c06"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/Language/zipball/b3bf9029c112414fdb7cd9de778df191565d3038", "url": "https://api.github.com/repos/pmmp/Language/zipball/a2c7071117c98ccc0e333994271cab1072eb3c06",
"reference": "b3bf9029c112414fdb7cd9de778df191565d3038", "reference": "a2c7071117c98ccc0e333994271cab1072eb3c06",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -554,9 +554,9 @@
"description": "Language resources used by PocketMine-MP", "description": "Language resources used by PocketMine-MP",
"support": { "support": {
"issues": "https://github.com/pmmp/Language/issues", "issues": "https://github.com/pmmp/Language/issues",
"source": "https://github.com/pmmp/Language/tree/2.16.0" "source": "https://github.com/pmmp/Language/tree/2.17.0"
}, },
"time": "2023-01-04T20:27:52+00:00" "time": "2023-01-13T17:22:45+00:00"
}, },
{ {
"name": "pocketmine/log", "name": "pocketmine/log",

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Jukebox as JukeboxTile; use pocketmine\block\tile\Jukebox as JukeboxTile;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\Record; use pocketmine\item\Record;
use pocketmine\lang\KnownTranslationKeys;
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\player\Player; use pocketmine\player\Player;
use pocketmine\world\sound\RecordSound; use pocketmine\world\sound\RecordSound;
@ -44,7 +45,7 @@ class Jukebox extends Opaque{
if($this->record !== null){ if($this->record !== null){
$this->ejectRecord(); $this->ejectRecord();
}elseif($item instanceof Record){ }elseif($item instanceof Record){
$player->sendJukeboxPopup("record.nowPlaying", [$player->getLanguage()->translate($item->getRecordType()->getTranslatableName())]); $player->sendJukeboxPopup(KnownTranslationKeys::RECORD_NOWPLAYING, [$player->getLanguage()->translate($item->getRecordType()->getTranslatableName())]);
$this->insertRecord($item->pop()); $this->insertRecord($item->pop());
} }
} }

View File

@ -2586,6 +2586,12 @@ final class KnownTranslationFactory{
return new Translatable(KnownTranslationKeys::QUERY_WARNING2, []); return new Translatable(KnownTranslationKeys::QUERY_WARNING2, []);
} }
public static function record_nowPlaying(Translatable|string $param0) : Translatable{
return new Translatable(KnownTranslationKeys::RECORD_NOWPLAYING, [
0 => $param0,
]);
}
public static function server_port() : Translatable{ public static function server_port() : Translatable{
return new Translatable(KnownTranslationKeys::SERVER_PORT, []); return new Translatable(KnownTranslationKeys::SERVER_PORT, []);
} }

View File

@ -549,6 +549,7 @@ final class KnownTranslationKeys{
public const QUERY_DISABLE = "query_disable"; public const QUERY_DISABLE = "query_disable";
public const QUERY_WARNING1 = "query_warning1"; public const QUERY_WARNING1 = "query_warning1";
public const QUERY_WARNING2 = "query_warning2"; public const QUERY_WARNING2 = "query_warning2";
public const RECORD_NOWPLAYING = "record.nowPlaying";
public const SERVER_PORT = "server_port"; public const SERVER_PORT = "server_port";
public const SERVER_PORT_V4 = "server_port_v4"; public const SERVER_PORT_V4 = "server_port_v4";
public const SERVER_PORT_V6 = "server_port_v6"; public const SERVER_PORT_V6 = "server_port_v6";