Benedikt05 / BetterAltay

A server software for Minecraft: Bedrock Edition in PHP
GNU Lesser General Public License v3.0
79 stars 37 forks source link

Inventory visual bug #185

Open vp817 opened 1 year ago

vp817 commented 1 year ago

Issue description

Steps to reproduce the issue

  1. create a new plugin
  2. add transaction event and cancel it

OS and versions

Plugins

the issue is not from plugins its from the software

Crashdump, backtrace or other files

There is no crashdump

AfterKing commented 3 months ago

$player->getCursorInventory()->setItem(0, Item::get(0), true);

vp817 commented 3 months ago

did this fix it?

$player->getCursorInventory()->setItem(0, Item::get(0), true);

vp817 commented 3 months ago

Send a video if so

AfterKing commented 3 months ago

https://github.com/Benedikt05/BetterAltay/assets/169461154/293053c2-b439-4d21-8539-028e22adfb43

AfterKing commented 3 months ago

` public function onInventoryTransaction(InventoryTransactionEvent $event) : void{

    $transaction = $event->getTransaction();
    $player = $transaction->getSource();
    $network_stack_callbacks = [];
    foreach($transaction->getActions() as $action){
        if($action instanceof SlotChangeAction && ($inventory = $action->getInventory()) instanceof InvMenuInventory){
            $result = $inventory->handleInventoryTransaction($player, $action->getSourceItem(), $action->getTargetItem(), $action, $transaction);
            $network_stack_callback = $result->getPostTransactionCallback();
            if($network_stack_callback !== null){
                $network_stack_callbacks[] = $network_stack_callback;
            }
            if($result->isCancelled()){
                                $player->getCursorInventory()->setItem(0, Item::get(0), true);
                $event->setCancelled();
                break;
            }
        }
    }
}`
vp817 commented 2 months ago

i will see that later

vp817 commented 2 months ago

@Benedikt05