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
22
declare(strict_types=1);
23
24
namespace
pocketmine\event\player
;
25
26
use
pocketmine\event\Event
;
27
use
pocketmine\player\PlayerInfo
;
28
use
pocketmine\resourcepacks\ResourcePack
;
29
use
function
array_unshift;
30
37
class
PlayerResourcePackOfferEvent
extends
Event
{
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
}
pocketmine\event\Event
Definition
Event.php:33
pocketmine\event\player\PlayerResourcePackOfferEvent
Definition
PlayerResourcePackOfferEvent.php:37
pocketmine\event\player\PlayerResourcePackOfferEvent\setResourcePacks
setResourcePacks(array $resourcePacks, array $encryptionKeys)
Definition
PlayerResourcePackOfferEvent.php:78
pocketmine\event\player\PlayerResourcePackOfferEvent\__construct
__construct(private readonly PlayerInfo $playerInfo, private array $resourcePacks, private array $encryptionKeys, private bool $mustAccept)
Definition
PlayerResourcePackOfferEvent.php:45
pocketmine\event\player\PlayerResourcePackOfferEvent\getResourcePacks
getResourcePacks()
Definition
PlayerResourcePackOfferEvent.php:87
pocketmine\event\player\PlayerResourcePackOfferEvent\addResourcePack
addResourcePack(ResourcePack $entry, ?string $encryptionKey=null)
Definition
PlayerResourcePackOfferEvent.php:60
pocketmine\event\player\PlayerResourcePackOfferEvent\getEncryptionKeys
getEncryptionKeys()
Definition
PlayerResourcePackOfferEvent.php:95
pocketmine\player\PlayerInfo
Definition
PlayerInfo.php:33
pocketmine\resourcepacks\ResourcePack
Definition
ResourcePack.php:26
pocketmine\resourcepacks\ResourcePack\getPackId
getPackId()
pocketmine\event\player
Definition
PlayerBedEnterEvent.php:24
src
event
player
PlayerResourcePackOfferEvent.php
Generated by
1.12.0