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

Giving a player an item which a has a semicolon in it

Discussion in 'Development' started by rektpixel, Oct 11, 2017.

  1. rektpixel

    rektpixel Baby Zombie

    Messages:
    106
    Hello, I am trying to give a player the item 397:3 (steve mob head) I have done this:
    PHP:
    $player->getInventory()->addItem(Item::get(388:301)->setCustomName("§a§lTeleport to Spawn §r§7§o(Tap)"));
    But it seems that it dosn't like the use of a semicolon. Is there any other way of giving the item to the player? I tried getting the item from the config but I had the same error:
    Code:
    [21:34:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Joinings v0.0.1': Argument 1 passed to pocketmine\item\Item::get() must be of the type integer, array given, called in C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\CombinedSlots-master\src\basprohop\CombinedSlots.php on line 84 on basprohop\CombinedSlots
    [21:34:33] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\item\Item::get() must be of the type integer, array given, called in C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\CombinedSlots-master\src\basprohop\CombinedSlots.php on line 84" (EXCEPTION) in "src/pocketmine/item/Item" at line 91
    [21:34:33] [Server thread/DEBUG]: #0 CombinedSlots-master/src/basprohop/CombinedSlots(84): pocketmine\item\Item::get(array Array(), integer 0, integer 1)
    [21:34:33] [Server thread/DEBUG]: #1 src/pocketmine/plugin/MethodEventExecutor(38): basprohop\CombinedSlots->onJoin(pocketmine\event\player\PlayerJoinEvent object)
    [21:34:33] [Server thread/DEBUG]: #2 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(basprohop\CombinedSlots object, pocketmine\event\player\PlayerJoinEvent object)
    [21:34:33] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(721): pocketmine\plugin\RegisteredListener->callEvent(pocketmine\event\player\PlayerJoinEvent object)
    [21:34:33] [Server thread/DEBUG]: #4 src/pocketmine/Player(951): pocketmine\plugin\PluginManager->callEvent(pocketmine\event\player\PlayerJoinEvent object)
    [21:34:33] [Server thread/DEBUG]: #5 src/pocketmine/Player(891): pocketmine\Player->doFirstSpawn()
    [21:34:33] [Server thread/DEBUG]: #6 src/pocketmine/level/Level(2387): pocketmine\Player->sendChunk(integer 1, integer -53, pocketmine\network\mcpe\protocol\BatchPacket object)
    [21:34:33] [Server thread/DEBUG]: #7 src/pocketmine/level/Level(2428): pocketmine\level\Level->sendChunkFromCache(integer 1, integer -53)
    [21:34:33] [Server thread/DEBUG]: #8 src/pocketmine/level/format/io/ChunkRequestTask(91): pocketmine\level\Level->chunkRequestCallback(integer 1, integer -53, pocketmine\network\mcpe\protocol\BatchPacket object)
    [21:34:33] [Server thread/DEBUG]: #9 src/pocketmine/scheduler/AsyncPool(164): pocketmine\level\format\io\ChunkRequestTask->onCompletion(pocketmine\Server object)
    [21:34:33] [Server thread/DEBUG]: #10 src/pocketmine/scheduler/ServerScheduler(342): pocketmine\scheduler\AsyncPool->collectTasks()
    [21:34:33] [Server thread/DEBUG]: #11 src/pocketmine/Server(2510): pocketmine\scheduler\ServerScheduler->mainThreadHeartbeat(integer 327)
    [21:34:33] [Server thread/DEBUG]: #12 src/pocketmine/Server(2257): pocketmine\Server->tick()
    [21:34:33] [Server thread/DEBUG]: #13 src/pocketmine/Server(2136): pocketmine\Server->tickProcessor()
    [21:34:33] [Server thread/DEBUG]: #14 src/pocketmine/Server(1718): pocketmine\Server->start()
    [21:34:33] [Server thread/DEBUG]: #15 src/pocketmine/PocketMine(556): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\)
    [21:34:33] [Server thread/DEBUG]: #16 C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar(1): require(string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    
    Please help if you can :)
     
  2. MioTaku

    MioTaku Witch

    Messages:
    51
    GitHub:
    uselesswaifu
    Here you go senpai
    Code:
    $player->getInventory()->addItem(Item::get(388, 3, 1)->setCustomName("§a§lTeleport to Spawn §r§7§o(Tap)"));
    
    The Second Argument in Item::get is damage or meta
     
    NickTehUnicorn likes this.
  3. rektpixel

    rektpixel Baby Zombie

    Messages:
    106
    no.. In your case you just made 3 is damage.
     
  4. MioTaku

    MioTaku Witch

    Messages:
    51
    GitHub:
    uselesswaifu
    If its a Block. Blocks can't have damage so it sets the meta
     
    Jack Noordhuis and rektpixel like this.
  5. MioTaku

    MioTaku Witch

    Messages:
    51
    GitHub:
    uselesswaifu
    You Could Do setType if you honestly don't want to do the other thing
     
  6. Kyd

    Kyd Zombie

    Messages:
    362
    3 have to be damage if you want to give item 397:3
     
    MioTaku likes this.
  7. rektpixel

    rektpixel Baby Zombie

    Messages:
    106
    oh thanks it worked :)
     
  8. MioTaku

    MioTaku Witch

    Messages:
    51
    GitHub:
    uselesswaifu
    Happy to not be useless once again
     
    rektpixel likes this.
  9. SOFe

    SOFe A-Team Staff Member PMMP Team Poggit Admin

    Messages:
    1,165
    GitHub:
    sof3
    It's called a colon, not a semicolon...
     
  10. MioTaku

    MioTaku Witch

    Messages:
    51
    GitHub:
    uselesswaifu
    I was thinking that but, didn't want to be rude. :p
     
  11. rektpixel

    rektpixel Baby Zombie

    Messages:
    106
    oh yeah lol
     
  12. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    646
    GitHub:
    winterbuild7074
    iiFlamiinBlaze likes this.

Share This Page