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

setCustomName

Comments in 'Plugin Development' started by TheMaks, Sep 30, 2015.

  1. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    Why? Why crash?
    Code:
    Fatal error: Call to undefined method pocketmine\item\Item::setCustomName() in phar:///root/3/plugins/partboom.phar/src/TheMaks/Main.php on line 95
    [15:20:04] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
    [15:20:04] [Server thread/EMERGENCY]: Please upload the "/root/3/CrashDump_Wed_Sep_30-15.20.04-MSK_2015.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.
    PHP:
             public function PopupItem(PlayerItemHeldEvent $event)
             {
                   if(
    $event->getPlayer() instanceof Player)
                      {
                                     
    $player $event->getPlayer();
                                     
    $item $event->getItem();
                                        if(
    $item->getId()  == 347)
                                           {  
    $item->setCustomName("Меню");
                                           switch(
    mt_rand(1,8))
                                           {
                                                 case 
    1:
                                                    
    $item->setCustomName("§1[Menu]");
                                                 break;
                                                 case 
    2:
                                                    
    $item->setCustomName("§a[Menu]");
                                                 break;
                                                 case 
    3:
                                                    
    $item->setCustomName("§3[Menu]");
                                                 break;
                                                 case 
    4:
                                                    
    $item->setCustomName("§e[Menu]");
                                                 break;
                                                 case 
    5:
                                                    
    $item->setCustomName("§5[Menu]");
                                                 break;                        
                                                 case 
    6:
                                                    
    $item->setCustomName("§2[Menu]");
                                                 break;
                                                 case 
    7:
                                                    
    $item->setCustomName("§4[Menu]");
                                                 break;
                                                 case 
    8:
                                                    
    $pitem->setCustomName("§6[Menu]");
                                                 break;
                                           }
                                        }
                             }
           }
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You are not using a PocketMine version that supports it.
  3. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    please give the version that supports it
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
  5. TonyDroide
    Offline

    TonyDroide Active Member Plugin Developer

    Joined:
    Jun 5, 2015
    Posts:
    122
    Plugins:
    1
    Minecraft User:
    TonyDroidd
    im usin the last blending build, and have this error;
    Code:
    Fatal error: Call to a member function setCustomName() on integer in C:\Users\Marcos\Documents\PocketMine-MP\plugins\NPECore (plugin)\src\TDroidd\NPECore\Main.php on line 148
    
  6. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Show the code on line 148, we aren't mind readers.

Share This Page

Advertisement