mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-14 22:01:59 +00:00
ResourcePackManager: avoid repeated operation
This commit is contained in:
parent
bda0ca23b4
commit
d6bbf8217d
@ -113,12 +113,13 @@ class ResourcePackManager{
|
|||||||
|
|
||||||
if($newPack instanceof ResourcePack){
|
if($newPack instanceof ResourcePack){
|
||||||
$this->resourcePacks[] = $newPack;
|
$this->resourcePacks[] = $newPack;
|
||||||
$this->uuidList[strtolower($newPack->getPackId())] = $newPack;
|
$index = strtolower($newPack->getPackId());
|
||||||
|
$this->uuidList[$index] = $newPack;
|
||||||
|
|
||||||
$keyPath = Path::join($this->path, $pack . ".key");
|
$keyPath = Path::join($this->path, $pack . ".key");
|
||||||
if(file_exists($keyPath)){
|
if(file_exists($keyPath)){
|
||||||
try{
|
try{
|
||||||
$this->encryptionKeys[strtolower($newPack->getPackId())] = ErrorToExceptionHandler::trapAndRemoveFalse(
|
$this->encryptionKeys[$index] = ErrorToExceptionHandler::trapAndRemoveFalse(
|
||||||
fn() => file_get_contents($keyPath)
|
fn() => file_get_contents($keyPath)
|
||||||
);
|
);
|
||||||
}catch(\ErrorException $e){
|
}catch(\ErrorException $e){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user