PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
PlayerResourcePackOfferEvent.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
25
29use function array_unshift;
30
45 public function __construct(
46 private readonly PlayerInfo $playerInfo,
47 private array $resourcePacks,
48 private array $encryptionKeys,
49 private bool $mustAccept
50 ){}
51
52 public function getPlayerInfo() : PlayerInfo{
53 return $this->playerInfo;
54 }
55
60 public function addResourcePack(ResourcePack $entry, ?string $encryptionKey = null) : void{
61 array_unshift($this->resourcePacks, $entry);
62 if($encryptionKey !== null){
63 $this->encryptionKeys[$entry->getPackId()] = $encryptionKey;
64 }
65 }
66
78 public function setResourcePacks(array $resourcePacks, array $encryptionKeys) : void{
79 $this->resourcePacks = $resourcePacks;
80 $this->encryptionKeys = $encryptionKeys;
81 }
82
87 public function getResourcePacks() : array{
88 return $this->resourcePacks;
89 }
90
95 public function getEncryptionKeys() : array{
96 return $this->encryptionKeys;
97 }
98
99 public function setMustAccept(bool $mustAccept) : void{
100 $this->mustAccept = $mustAccept;
101 }
102
103 public function mustAccept() : bool{
104 return $this->mustAccept;
105 }
106}
setResourcePacks(array $resourcePacks, array $encryptionKeys)
__construct(private readonly PlayerInfo $playerInfo, private array $resourcePacks, private array $encryptionKeys, private bool $mustAccept)
addResourcePack(ResourcePack $entry, ?string $encryptionKey=null)