Set the Crafting Result to air

Discussion in 'Plugin Development' started by -JHB-, May 3, 2011.

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

    -JHB-

    So basicly what i'm looking for is a way to prevent somebody from crafting some item.
    I'm now stuck at the IInventory class.
    I just need a simple way to keep the server from creating the new item stack and removing the used items.
    Code:
         ItemStack[] result = ((containerBench.a.getContents()));
    
                if (this.plugin.getPlayerListener().lookup(result[0].id,craftPlayer, this.plugin.getPlayerListener().lookPermissions(craftPlayer)) == false ){
                    containerBench.b.a(0, 0);
                    }
                    else {kill();
                        return;
                    }
    the lookup functions just look if he git the right to place it.

    I hope sobody can help me :]
    thanks
     
  2. Offline

    nickguletskii

  3. Offline

    FrozenBrain

    But he wants to prevent a specific player from crafting something, doesn't he?

    I recently tried to do the same thing. I edited the ContainerWorkbench.java file to call a new event called PLAYER_CRAFT and check, if it's been cancelled or not. If it has been cancelled, the server just doesn't send the SetSlot packet so the player does not get the crafted item.
     
  4. Offline

    nickguletskii

    Oooh... Specific person... Didn't think of that XD
     
  5. Offline

    Afforess

    Can't say any solution ATM, but it's a feature that BukkitContrib will have soon.
    (Sorry normal people, only plugin developers and mods can see the link contents. ;) )
     
  6. Offline

    -JHB-

    can you dropbox it or something :]

    would be nice to have a look at.

    can you give me a date since i can't get onto the site? ^^
     
  7. Offline

    Afforess

    Not sure, but possibly a test release this weekend.
     
  8. Offline

    -JHB-

    ok i freeze my plug till then... =/
    thanks :)
     
Thread Status:
Not open for further replies.

Share This Page