mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
Merge branch 'major-next' into inventory-rework
This commit is contained in:
commit
5a35c25ad4
5
.github/workflows/team-pr-auto-approve.yml
vendored
5
.github/workflows/team-pr-auto-approve.yml
vendored
@ -11,8 +11,7 @@ on:
|
|||||||
- opened
|
- opened
|
||||||
- reopened
|
- reopened
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
pull_request_review:
|
- synchronize
|
||||||
types: dismissed
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dispatch:
|
dispatch:
|
||||||
@ -36,4 +35,4 @@ jobs:
|
|||||||
token: ${{ steps.generate-token.outputs.token }}
|
token: ${{ steps.generate-token.outputs.token }}
|
||||||
repository: ${{ github.repository_owner }}/RestrictedActions
|
repository: ${{ github.repository_owner }}/RestrictedActions
|
||||||
event-type: auto_approve_collaborator_pr
|
event-type: auto_approve_collaborator_pr
|
||||||
client-payload: '{"repo": "${{ github.repository }}", "pull_request_id": "${{ github.event.pull_request.number }}", "reviewer_id": "${{ github.event.review.user.id || 0 }}" }'
|
client-payload: '{"repo": "${{ github.repository }}", "pull_request_id": "${{ github.event.pull_request.number }}", "reviewer_id": "0" }'
|
||||||
|
@ -112,6 +112,9 @@ class InventoryTransaction{
|
|||||||
if(!isset($this->actions[$hash = spl_object_id($action)])){
|
if(!isset($this->actions[$hash = spl_object_id($action)])){
|
||||||
$this->actions[$hash] = $action;
|
$this->actions[$hash] = $action;
|
||||||
$action->onAddToTransaction($this);
|
$action->onAddToTransaction($this);
|
||||||
|
if($action instanceof SlotChangeAction && !isset($this->inventoryWindows[$inventoryId = spl_object_id($action->getInventoryWindow())])){
|
||||||
|
$this->inventoryWindows[$inventoryId] = $action->getInventoryWindow();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
throw new \InvalidArgumentException("Tried to add the same action to a transaction twice");
|
throw new \InvalidArgumentException("Tried to add the same action to a transaction twice");
|
||||||
}
|
}
|
||||||
@ -130,16 +133,6 @@ class InventoryTransaction{
|
|||||||
$this->actions = $actions;
|
$this->actions = $actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal This method should not be used by plugins, it's used to add tracked inventories for InventoryActions
|
|
||||||
* involving inventories.
|
|
||||||
*/
|
|
||||||
public function addInventoryWindow(InventoryWindow $inventoryWindow) : void{
|
|
||||||
if(!isset($this->inventoryWindows[$hash = spl_object_id($inventoryWindow)])){
|
|
||||||
$this->inventoryWindows[$hash] = $inventoryWindow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Item[] $needItems
|
* @param Item[] $needItems
|
||||||
* @param Item[] $haveItems
|
* @param Item[] $haveItems
|
||||||
|
@ -60,6 +60,7 @@ abstract class InventoryAction{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the action is added to the specified InventoryTransaction.
|
* Called when the action is added to the specified InventoryTransaction.
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function onAddToTransaction(InventoryTransaction $transaction) : void{
|
public function onAddToTransaction(InventoryTransaction $transaction) : void{
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ namespace pocketmine\inventory\transaction\action;
|
|||||||
|
|
||||||
use pocketmine\inventory\Inventory;
|
use pocketmine\inventory\Inventory;
|
||||||
use pocketmine\inventory\SlotValidatedInventory;
|
use pocketmine\inventory\SlotValidatedInventory;
|
||||||
use pocketmine\inventory\transaction\InventoryTransaction;
|
|
||||||
use pocketmine\inventory\transaction\TransactionValidationException;
|
use pocketmine\inventory\transaction\TransactionValidationException;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\player\InventoryWindow;
|
use pocketmine\player\InventoryWindow;
|
||||||
@ -87,13 +86,6 @@ class SlotChangeAction extends InventoryAction{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds this action's target inventory to the transaction's inventory list.
|
|
||||||
*/
|
|
||||||
public function onAddToTransaction(InventoryTransaction $transaction) : void{
|
|
||||||
$transaction->addInventoryWindow($this->inventoryWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the item into the target inventory.
|
* Sets the item into the target inventory.
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\permission;
|
namespace pocketmine\permission;
|
||||||
|
|
||||||
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\Utils;
|
use pocketmine\utils\Utils;
|
||||||
use function count;
|
use function count;
|
||||||
use function spl_object_id;
|
use function spl_object_id;
|
||||||
@ -71,6 +72,10 @@ class PermissionManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Superseded by server chat broadcast channels
|
||||||
|
* @see Server::subscribeToBroadcastChannel()
|
||||||
|
*/
|
||||||
public function subscribeToPermission(string $permission, PermissibleInternal $permissible) : void{
|
public function subscribeToPermission(string $permission, PermissibleInternal $permissible) : void{
|
||||||
if(!isset($this->permSubs[$permission])){
|
if(!isset($this->permSubs[$permission])){
|
||||||
$this->permSubs[$permission] = [];
|
$this->permSubs[$permission] = [];
|
||||||
@ -78,6 +83,10 @@ class PermissionManager{
|
|||||||
$this->permSubs[$permission][spl_object_id($permissible)] = $permissible;
|
$this->permSubs[$permission][spl_object_id($permissible)] = $permissible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Superseded by server chat broadcast channels
|
||||||
|
* @see Server::unsubscribeFromBroadcastChannel()
|
||||||
|
*/
|
||||||
public function unsubscribeFromPermission(string $permission, PermissibleInternal $permissible) : void{
|
public function unsubscribeFromPermission(string $permission, PermissibleInternal $permissible) : void{
|
||||||
if(isset($this->permSubs[$permission][spl_object_id($permissible)])){
|
if(isset($this->permSubs[$permission][spl_object_id($permissible)])){
|
||||||
if(count($this->permSubs[$permission]) === 1){
|
if(count($this->permSubs[$permission]) === 1){
|
||||||
@ -88,6 +97,10 @@ class PermissionManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Superseded by server chat broadcast channels
|
||||||
|
* @see Server::unsubscribeFromAllBroadcastChannels()
|
||||||
|
*/
|
||||||
public function unsubscribeFromAllPermissions(PermissibleInternal $permissible) : void{
|
public function unsubscribeFromAllPermissions(PermissibleInternal $permissible) : void{
|
||||||
foreach(Utils::promoteKeys($this->permSubs) as $permission => $subs){
|
foreach(Utils::promoteKeys($this->permSubs) as $permission => $subs){
|
||||||
if(count($subs) === 1 && isset($subs[spl_object_id($permissible)])){
|
if(count($subs) === 1 && isset($subs[spl_object_id($permissible)])){
|
||||||
@ -99,6 +112,8 @@ class PermissionManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated Superseded by server chat broadcast channels
|
||||||
|
* @see Server::getBroadcastChannelSubscribers()
|
||||||
* @return PermissibleInternal[]
|
* @return PermissibleInternal[]
|
||||||
*/
|
*/
|
||||||
public function getPermissionSubscriptions(string $permission) : array{
|
public function getPermissionSubscriptions(string $permission) : array{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user