PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
pocketmine\event\player\PlayerResourcePackOfferEvent Class Reference
+ Inheritance diagram for pocketmine\event\player\PlayerResourcePackOfferEvent:
+ Collaboration diagram for pocketmine\event\player\PlayerResourcePackOfferEvent:

Public Member Functions

 __construct (private readonly PlayerInfo $playerInfo, private array $resourcePacks, private array $encryptionKeys, private bool $mustAccept)
 
 addResourcePack (ResourcePack $entry, ?string $encryptionKey=null)
 
 call ()
 
 getEncryptionKeys ()
 
 getEventName ()
 
 getPlayerInfo ()
 
 getResourcePacks ()
 
 mustAccept ()
 
 setMustAccept (bool $mustAccept)
 
 setResourcePacks (array $resourcePacks, array $encryptionKeys)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $eventName = null
 

Detailed Description

Called after a player authenticates and is being offered resource packs to download.

This event should be used to decide which resource packs to offer the player and whether to require the player to download the packs before they can join the server.

Definition at line 37 of file PlayerResourcePackOfferEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\player\PlayerResourcePackOfferEvent::__construct ( private readonly PlayerInfo $playerInfo,
private array $resourcePacks,
private array $encryptionKeys,
private bool $mustAccept )
Parameters
ResourcePack[]$resourcePacks
string[]$encryptionKeyspack UUID => key, leave unset for any packs that are not encrypted

@phpstan-param list<ResourcePack> $resourcePacks @phpstan-param array<string, string> $encryptionKeys

Definition at line 45 of file PlayerResourcePackOfferEvent.php.

Member Function Documentation

◆ addResourcePack()

pocketmine\event\player\PlayerResourcePackOfferEvent::addResourcePack ( ResourcePack $entry,
?string $encryptionKey = null )

Adds a resource pack to the top of the stack. The resources in this pack will be applied over the top of any existing packs.

Definition at line 60 of file PlayerResourcePackOfferEvent.php.

References pocketmine\resourcepacks\ResourcePack\getPackId().

+ Here is the call graph for this function:

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getEncryptionKeys()

pocketmine\event\player\PlayerResourcePackOfferEvent::getEncryptionKeys ( )
Returns
string[] @phpstan-return array<string, string>

Definition at line 95 of file PlayerResourcePackOfferEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getPlayerInfo()

pocketmine\event\player\PlayerResourcePackOfferEvent::getPlayerInfo ( )

Definition at line 52 of file PlayerResourcePackOfferEvent.php.

◆ getResourcePacks()

pocketmine\event\player\PlayerResourcePackOfferEvent::getResourcePacks ( )
Returns
ResourcePack[] @phpstan-return list<ResourcePack>

Definition at line 87 of file PlayerResourcePackOfferEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ mustAccept()

pocketmine\event\player\PlayerResourcePackOfferEvent::mustAccept ( )

Definition at line 103 of file PlayerResourcePackOfferEvent.php.

◆ setMustAccept()

pocketmine\event\player\PlayerResourcePackOfferEvent::setMustAccept ( bool $mustAccept)

Definition at line 99 of file PlayerResourcePackOfferEvent.php.

◆ setResourcePacks()

pocketmine\event\player\PlayerResourcePackOfferEvent::setResourcePacks ( array $resourcePacks,
array $encryptionKeys )

Sets the resource packs to offer. Packs are applied from the highest key to the lowest, with each pack overwriting any resources from the previous pack. This means that the pack at index 0 gets the final say on which resources are used.

Parameters
ResourcePack[]$resourcePacks
string[]$encryptionKeyspack UUID => key, leave unset for any packs that are not encrypted

@phpstan-param list<ResourcePack> $resourcePacks @phpstan-param array<string, string> $encryptionKeys

Definition at line 78 of file PlayerResourcePackOfferEvent.php.

Member Data Documentation

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.


The documentation for this class was generated from the following file: