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

Does CraftItemEvent work?

Comments in 'Plugin Development' started by aliuly, Aug 21, 2015.

  1. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Hi, I have this simple script plugin:

    PHP:
    /**
     * @name craftingCheck
     * @main aliuly\hack\Crafting
     * @version 1.0.0
     * @api 1.12.0
     * @description Checks crafting events
     * @author aliuly
     */
    namespace aliuly\hack{
       use 
    pocketmine\plugin\PluginBase;
       use 
    pocketmine\event\Listener;
       use 
    pocketmine\event\inventory\CraftItemEvent;

       class 
    Crafting extends PluginBase implements Listener{
         public function 
    onEnable(){
           
    $this->getLogger()->info(__METHOD__.",".__LINE__);
           
    $this->getServer()->getPluginManager()->registerEvents($this$this);
         }
         public function 
    onCrafing(CraftItemEvent $ev) {
           
    $this->getLogger()->info(__METHOD__.",".__LINE__);
         }
       }
    }

    From what I understand, it should be showing some text when somebody is crafting something But nothing is shown. Anybody has any idea if this should work or not?
  2. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    What version of PocketMine were you testing the plugin on?
  3. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    1.5
  4. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Have you tested it on all the builds yet?
  5. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    That would be pointless.
    xXCyrerXx and PixelGuy75 like this.
  6. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Then it doesn't work(at all). Period.
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    hm i think craftItemEvent is buggy. i have some problems with it too
    Legoboy0215 likes this.
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    I can't cancel it too.
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried it in pocketmine 1.6 and i think it works but players cant craft when i dont cancel it too xD
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The event is fired from CraftingTransactionGroup, which I found no new instance usage in source.
    Creeperface likes this.

Share This Page

Advertisement