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

cancel craftItemEvent

Comments in 'Plugin Development' started by Creeperface, Jul 28, 2015.

Thread Status:
Not open for further replies.
  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried cancel CraftItemEvent but players still can craft items :/
    MCPEPIG likes this.
  2. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried it :D but players still can craft xD
    yes only setCancelled();
    Last edited: Jul 28, 2015
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function onCraft(CraftItemEvent $e){
            
    $e->setCancelled();
        }
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried too:
    PHP:
    public function onTransaction(\pocketmine\event\inventory\InventoryTransactionEvent $e){
            if(
    $e->getTransaction() instanceof \pocketmine\inventory\CraftingTransactionGroup){
                
    $e->setCancelled();
            }
        }
    PEMapModder likes this.
  6. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    shit...this was my next idear xD
    PEMapModder and Creeperface like this.
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    :D but doesnt work too
  8. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    what exactly want you do with this? if you tell me the idear we can think about other ways ?
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i want to disable crafting in my bedwars minigame
  10. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Try removing crafted item and give back items used for crafting
  11. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    no it is complicated and cancel craftItemEvent must work too
  12. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    so why it doesnt work is it pocketmine bug?
    Legoboy0215 likes this.
  13. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    I tried too. Not working.
  14. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    PHP:
    $event->setCanelled(true); // Force cancel
    Looking for other way...
  15. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    no it is tha same like setCancelled();
    PEMapModder likes this.
  16. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    PHP:
    public function onPlayerInteract(PlayerInteractEvent $event){
    $player $event->getPlayer();
    $b $event->getBlock();
    if(
    true/*Check here if player is in game idk what method u use*/){
    if(
    $b->getId() == Block::CRAFTING_TABLE){
    $event->setCancelled(true);
    }
    }
    }
  17. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    it won´t work crafting inventory is opened by client
  18. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Inventory can be closes i think.
  19. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    PHP:
    public function onInventoryOpen(InventoryOpenEvent $event){
    $p $event->getPlayer();
    $inv $event->getInventory();
    if(
    $inv instanceof CraftInventory){
    $event->setCancelled(true);
    return;
    }
    }
  20. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    you can stop it with the interact event that the crating table open....

    public onInter(PlayerInteractEvent $event)
    {
    $block = $event->getBlock()->getId();
    if($block == cratingtable id (dont know yet))
    {
    $event->setCancelled(); <---- its allways true
Thread Status:
Not open for further replies.

Share This Page

Advertisement