mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Merge branch 'stable'
# Conflicts: # resources/vanilla # src/event/player/PlayerCreationEvent.php
This commit is contained in:
1
.github/ISSUE_TEMPLATE/crash.md
vendored
1
.github/ISSUE_TEMPLATE/crash.md
vendored
@ -9,6 +9,7 @@ assignees: ''
|
|||||||
|
|
||||||
<!--- submit crashdump files to https://crash.pmmp.io -->
|
<!--- submit crashdump files to https://crash.pmmp.io -->
|
||||||
<!--- or, copy the data between ===BEGIN CRASH DUMP=== and ===END CRASH DUMP and paste it on a site like https://pastebin.com -->
|
<!--- or, copy the data between ===BEGIN CRASH DUMP=== and ===END CRASH DUMP and paste it on a site like https://pastebin.com -->
|
||||||
|
<!--- DON'T JUST PASTE the crashdump into an issue -->
|
||||||
Link to crashdump:
|
Link to crashdump:
|
||||||
|
|
||||||
<!--- write additional information about the crash to help us find the problem -->
|
<!--- write additional information about the crash to help us find the problem -->
|
||||||
|
@ -36,9 +36,15 @@ class PlayerCreationEvent extends Event{
|
|||||||
/** @var NetworkSession */
|
/** @var NetworkSession */
|
||||||
private $session;
|
private $session;
|
||||||
|
|
||||||
/** @var string */
|
/**
|
||||||
|
* @var string
|
||||||
|
* @phpstan-var class-string<Player>
|
||||||
|
*/
|
||||||
private $baseClass = Player::class;
|
private $baseClass = Player::class;
|
||||||
/** @var string */
|
/**
|
||||||
|
* @var string
|
||||||
|
* @phpstan-var class-string<Player>
|
||||||
|
*/
|
||||||
private $playerClass = Player::class;
|
private $playerClass = Player::class;
|
||||||
|
|
||||||
public function __construct(NetworkSession $session){
|
public function __construct(NetworkSession $session){
|
||||||
@ -59,6 +65,7 @@ class PlayerCreationEvent extends Event{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @phpstan-return class-string<Player>
|
||||||
*/
|
*/
|
||||||
public function getBaseClass(){
|
public function getBaseClass(){
|
||||||
return $this->baseClass;
|
return $this->baseClass;
|
||||||
@ -66,6 +73,7 @@ class PlayerCreationEvent extends Event{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $class
|
* @param string $class
|
||||||
|
* @phpstan-param class-string<Player> $class
|
||||||
*/
|
*/
|
||||||
public function setBaseClass($class) : void{
|
public function setBaseClass($class) : void{
|
||||||
if(!is_a($class, $this->baseClass, true)){
|
if(!is_a($class, $this->baseClass, true)){
|
||||||
@ -77,6 +85,7 @@ class PlayerCreationEvent extends Event{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @phpstan-return class-string<Player>
|
||||||
*/
|
*/
|
||||||
public function getPlayerClass(){
|
public function getPlayerClass(){
|
||||||
return $this->playerClass;
|
return $this->playerClass;
|
||||||
@ -84,6 +93,7 @@ class PlayerCreationEvent extends Event{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $class
|
* @param string $class
|
||||||
|
* @phpstan-param class-string<Player> $class
|
||||||
*/
|
*/
|
||||||
public function setPlayerClass($class) : void{
|
public function setPlayerClass($class) : void{
|
||||||
if(!is_a($class, $this->baseClass, true)){
|
if(!is_a($class, $this->baseClass, true)){
|
||||||
|
@ -108,7 +108,16 @@ class PermissionAttachment{
|
|||||||
if($this->permissions[$name] === $value){
|
if($this->permissions[$name] === $value){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unset($this->permissions[$name]); //Fixes children getting overwritten
|
/* Because of the way child permissions are calculated, permissions which were set later in time are
|
||||||
|
* preferred over earlier ones when conflicts in inherited permission values occur.
|
||||||
|
* Here's the kicker: This behaviour depends on PHP's internal array ordering, which maintains insertion
|
||||||
|
* order -- BUT -- assigning to an existing index replaces the old value WITHOUT changing the order.
|
||||||
|
* (what crazy person thought relying on this this was a good idea?!?!?!?!?!)
|
||||||
|
*
|
||||||
|
* This removes the old value so that the new value will be added at the end of the array's internal order
|
||||||
|
* instead of directly taking the place of the older value.
|
||||||
|
*/
|
||||||
|
unset($this->permissions[$name]);
|
||||||
}
|
}
|
||||||
$this->permissions[$name] = $value;
|
$this->permissions[$name] = $value;
|
||||||
$this->permissible->recalculatePermissions();
|
$this->permissible->recalculatePermissions();
|
||||||
|
@ -143,7 +143,7 @@ class PermissionManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|Permissible[]
|
* @return Permissible[]
|
||||||
*/
|
*/
|
||||||
public function getPermissionSubscriptions(string $permission) : array{
|
public function getPermissionSubscriptions(string $permission) : array{
|
||||||
return $this->permSubs[$permission] ?? [];
|
return $this->permSubs[$permission] ?? [];
|
||||||
|
Reference in New Issue
Block a user