Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help events

Comments in 'Plugin Development' started by vlad46, Apr 12, 2015.

  1. vlad46
    Offline

    vlad46 New Member

    Joined:
    Mar 21, 2014
    Posts:
    12
    vWhat events are responsible for dragging the item from the chest to the player?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    InventoryTransactionEvent
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Hey Modder ;), i was testing PlayerInteractEvent i tried to teleport player when he taps Trapdoor
    PHP:
    public function PlayerInteractEvent(PlayerInteractEvent $e){
    $block $e->getBlock();
    if(
    $block == "Trapdoor"){
    $this->getLogger()->info("1. Worked!");
    }
    else{
    $this->getLogger()->info("2. Worked");
    {
    }
    Should i use "==" or "==="?

    Main question: It always runs 2., Why ?
  4. vlad46
    Offline

    vlad46 New Member

    Joined:
    Mar 21, 2014
    Posts:
    12
    How do I make so that if a player from the trunk takes the item ID under 50 and the subject remained in the chest and he wrote that you cannot take this course?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Create a thread, don't spam on this thread, OK?
  6. vlad46
    Offline

    vlad46 New Member

    Joined:
    Mar 21, 2014
    Posts:
    12
    Help please.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    $event->getTransaction()->getInventories();
    This should return an array of two (or more) inventories. In the case of from chest inventory to player inventory, it should have one ChestInventory instance and one PlayerInventory instance.
  8. vlad46
    Offline

    vlad46 New Member

    Joined:
    Mar 21, 2014
    Posts:
    12
    Can I make brief function? This is my first time working with inventory.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I had experience working with InventoryTransactionEvent months ago too, but that plugin never got finished. I recommend you to look at the PocketMine source code to use it correctly.

Share This Page

Advertisement