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

Solved Remove Creative Item with Meta

Comments in 'Plugin Development' started by jjmc, Nov 7, 2015.

  1. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Hi,
    I'm trying to remove all dangerous Items from Creative-Inventory with:
    PHP:
    public function onEnable() {
            
    Item::removeCreativeItem(Item::get(7));
            
    Item::removeCreativeItem(Item::get(46));
            
    Item::removeCreativeItem(Item::get(52));
            
    Item::removeCreativeItem(Item::get(247));
            
    Item::removeCreativeItem(Item::get(259));
            
    Item::removeCreativeItem(Item::get(325));
            
    Item::removeCreativeItem(Item::get(383));
        }
    But when I go in game, there is removed everything but not items with meta like 383 -> Monster Spawn egg does not remove Zombie Spawn Egg and Villager Spawn Egg and 325 -> Bucket does not remove Lava-Bucket or Water-Bucket. How can I remove them? I've tried 383:54 but it's a syntax error and there's no Zombie Spawn Egg in Item::, only SpawnEgg.
  2. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Item::get($id, $meta, $count);
    #ReadDocs
  3. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Sorry, didn't saw it in the docs
  4. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    The correct syntax for the function is:
    PHP:
    Item::get(int $idint $metaint $count, array $tags);
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    var_dump($tags);
    ?
  6. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    (array) $tags
  7. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Any idea why
    PHP:
    Item::removeCreativeItem(Item::get(383540));
    does not work? Item is still there. 383 = Spawn Egg, 54 = Zombie Meta
  8. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    You error is in the 3rd parameter of the get function, setting the count to 0 may take no effect, just use something like:
    PHP:
    Item::removeCreativeItem(Item::get(38354));
  9. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Item::removeCreativeItem(Item::get(383, 54)); does not work, too. Also tried it.
  10. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
  11. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
  12. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Which PocketMine API version are you using? For which version of MCPE? and (if the case) which build number is it?
  13. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Latest Bleeding Build #48 for MCPE 0.12

    [19:22:06] [Server thread/INFO]: This server is running PocketMine-MP 1.6dev-48 「[REDACTED]」 implementing API version 1.13.0 for Minecraft: PE v0.12.1 alpha (protocol version 34)
  14. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Man, those builds are not intended to be used, MCPE protocol got broken communication with PMMP in its last version, that's why it's a "development" build :p
  15. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Okay, but there's still no stable or beta for 0.12 :(
  16. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Nope
  17. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    can you give me the plugins xD, i want it to my server too..
  18. jjmc
    Offline

    jjmc New Member

    Joined:
    Oct 18, 2015
    Posts:
    41
    Unfortunately, the plugin I've made does not work yet because PocketMine protocol got broken so I can't test if it works and finish it.

Share This Page

Advertisement