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

how to remove item from player ?

Comments in 'Plugin Development' started by XWITHERHEROX, Dec 27, 2015.

  1. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    hello, i want help
    i want remove item or block from player
    like >> the player have 32 diamonds !
    i want remove 5 dimaond from the player :)
    and the 27 diamond stell wath him
    how ?



    sorry for bad english !
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    PHP:
    $inventory->removeItem(Item::get(Item::DIAMOND05));
    XWITHERHEROX likes this.
  3. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    thinks taha !
  4. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    but how to remove minecart item ?
  5. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    PHP:
    public function onItemHeld(PlayerItemHeldEvent $eve1){
    if(
    $eve1->getPlayer()->getInventory()->getItemInHand()->getId() === 281){
    $eve1->getPlayer()->sendTip(Color::YELLOW." You have now a PACKAGE tools !!");
    $eve1->getPlayer()->getInventory()->removeItem(Item::get(Item::Bowl01));
    $eve1->getPlayer()->addEffect(Effect::getEffect(8)->setDuration(100)->setAmplifier(9));
    }
    }
    this will work ?
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    nope
  7. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    Wich language did u speak normally? German?
  8. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Youu Want Remove Item WITH ID ?
    PHP:
    $count 3;
    $id 1;
    $player->getInventory()->removeItem($id,0,$count);
    Omar2s2 and XWITHERHEROX like this.
  9. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Arabic, this is not the English forums actually -.-
    XWITHERHEROX likes this.
  10. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    PHP:
    public function onItemHeld(PlayerItemHeldEvent $eve1){
    if(
    $eve1->getPlayer()->getInventory()->getItemInHand()->getId() === 328){
    $level $this->getServer()->getLevelByName("mg");
    $p $eve1->getPlayer();
    $eve1->getPlayer()->sendTip(Color::YELLOW." You have now a PACKAGE tools !!");
    $count 1;
    $id 328;
    $eve1->getPlayer()->getInventory()->removeItem($id,0,$count);
    $level->addParticle(new ExplodeParticle(new Vector3($p->x$p->2$p->z)));
    $eve1->getPlayer()->addEffect(Effect::getEffect(5)->setDuration(100)->setAmplifier(2));
    }
    }
    is not working :)
  11. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    This is the correct one

Share This Page

Advertisement