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

What an error?!

Comments in 'Plugin Development' started by Asidert, Apr 22, 2015.

  1. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    I run my lucky blocks plugin and if i touch "lucky block" console have new error message...
    Console:

    [Server] 13:55:32 [WARNING] Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to "UTC" by default. You can change it on the php.ini file.
    [Server] 13:55:32 [INFO] Loading pocketmine.yml...
    [Server] 13:55:32 [INFO] Loading server properties...
    [Server] 13:55:32 [INFO] Selected English (eng) as the base language
    [Server] 13:55:32 [INFO] Starting Minecraft: PE server version v0.11.0 alpha build 5
    [Server] 13:55:32 [NOTICE] The memory-limit setting has been deprecated.
    [Server] 13:55:32 [NOTICE] There are new memory settings on pocketmine.yml to tune memory and events.
    [Server] 13:55:32 [NOTICE] You can also reduce the amount of threads and chunks loaded control the memory usage.
    [Server] 13:55:32 [INFO] Opening server on 0.0.0.0:19132
    [Server] 13:55:33 [INFO] This server is running PocketMine-MP version 1.5dev-1076 "活発(Kappatsu)フグ(Fugu)" (API 1.12.0)
    [Server] 13:55:33 [INFO] PocketMine-MP is distributed under the LGPL License
    [Server] 13:55:34 [INFO] Loading DevTools v1.10.0
    [Server] 13:55:34 [INFO] Loading FineFastFood v2.0
    [Server] 13:55:39 [INFO] Enabling DevTools v1.10.0
    [Server] 13:55:39 [INFO] Loading source plugin FineLuckyBlocks v2
    [Server] 13:55:39 [INFO] Loading source plugin Finecraft_SkyWars v0.1
    [Server] 13:55:39 [INFO] [DevTools] Registered folder plugin loader
    [Server] 13:55:39 [INFO] Preparing level "world"
    [Server] 13:55:40 [INFO] Enabling FineFastFood v2.0
    [Server] 13:55:40 [INFO] Enabling FineLuckyBlocks v2
    [Server] 13:55:40 [INFO] [FineLuckyBlocks] Активация Лаки Блоков от Бориса
    [Server] 13:55:40 [INFO] Enabling Finecraft_SkyWars v0.1
    [Server] 13:55:40 [INFO] [Finecraft_SkyWars] Finecraft SkyWars - Включение...
    [Server] 13:55:40 [INFO] [Finecraft_SkyWars] Finecraft SkyWars - Включение арен...
    [Server] 13:55:40 [INFO] [Finecraft_SkyWars] Finecraft SkyWars плагин полностью активирован !
    [Server] 13:55:41 [INFO] Starting GS4 status listener
    [Server] 13:55:41 [INFO] Setting query port to 19132
    [Server] 13:55:41 [INFO] Query running on 0.0.0.0:19132
    [Server] 13:55:41 [INFO] Default game type: Survival Mode
    [Server] 13:55:41 [INFO] Done (14.956s)! For help, type "help" or "?"
    [Server] 13:55:41 [INFO] Asidert[/192.168.1.33:36537] logged in with entity id 1 at (world, 129.5776, 70, 124.4827)
    [Server] 13:55:42 [INFO] There are 1/20 players online: Asidert
    [Server] 13:55:43 [INFO] Asidert joined the game
    [Server] 13:55:57 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:57 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:57 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:57 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:57 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:57 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:58 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:58 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:58 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:58 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:58 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:58 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:55:58 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:55:58 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:10 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:10 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:10 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:10 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:10 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:10 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:10 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:10 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:10 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:10 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:11 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:11 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:11 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:11 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:11 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:11 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:11 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FineLuckyBlocks v2': Object of class pocketmine\item\ItemBlock could not be converted to int on Asidert\FineLuckyBlocks
    [Server] 13:56:11 [NOTICE] ClassCastException: "Object of class pocketmine\item\ItemBlock could not be converted to int" (E_NOTICE) in "/src/pocketmine/item/Item" at line 891
    [Server] 13:56:18 [INFO] Disabling DevTools v1.10.0
    [Server] 13:56:18 [INFO] Disabling FineFastFood v2.0
    [Server] 13:56:18 [CRITICAL] pocketmine\utils\PluginException: "Plugin attempted to register Asidert\FineFastFood while not enabled" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager" at line 697
    [Server] 13:56:18 [INFO] Disabling FineLuckyBlocks v2
    [Server] 13:56:18 [INFO] [FineLuckyBlocks] Деактивация Лаки Блоков от Бориса
    [Server] 13:56:18 [INFO] Disabling Finecraft_SkyWars v0.1
    [Server] 13:56:18 [INFO] Asidert left the game
    [Server] 13:56:18 [INFO] Asidert[/192.168.1.33:36537] logged out due to Server closed
    [Server] 13:56:18 [INFO] Unloading level "world"
    [Server] 13:56:19 [INFO] Stopping other threads
    [PocketMine] Server was stopped.
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Can you please provide the plugin in the original php format?
  3. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Some code:
    PHP:
    public function... Blah Blah Blah...{
            
    $rewit=rand(1,2);
            if(
    $rewit 1){
            
    $reward==new Item(Item::get(rand(1,4), 0rand(1,32)));
            }
            if(
    $rewit 2){
            
    $reward==new Item(Item::get(5rand(0,5), rand(0,32)));
            }

         
    $event->getBlock()->getLevel->setBlock(new Air);
         
    $event->getBlock()->getLevel->dropItem($reward);
    }
  4. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    I prefer to use mt_rand than rand. Use double = to checking
    PHP:
    $rewit=mt_rand(1,2);
    if(
    $rewit == 1){$reward = new Item(Item::get(mt_rand(1,4), 0mt_rand(1,32)));
     }
     if(
    $rewit == 2){$reward = new Item(Item::get(5mt_rand(0,5), mt_rand(0,32)));
     }
    Try my code.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use Item::get() instead, or some specific items may not function.

    Edit: wait, Item::get() already returns an instance of Item. What are you doing, using new Item() here? What do you think you're doing?
    Can you please use a spoiler?
  6. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    Okay.
    PHP:
    $rewit=mt_rand(1,2);
     switch(
    $rewit){
      case 
    1:
        
    $reward Item::get(mt_rand(1,4), 0mt_rand(1,32));
      break;
      case 
    2:
        
    $reward Item::get(5mt_rand(0,5), mt_rand(0,32));
      break;
     }
  7. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    I know what it is... When he checks to see if its a gold block, he does
    PHP:
    if($ev->getBlock() == 123)
    When he should do
    PHP:
    if($ev->getBlock()->getID() == 123)
    I think that's the issue, when reading the error
  8. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    You also need to specify a vector3 when setting a block.

    PHP:
    $block->getLevel()->setBlock(new Vector3($block->getX(), $block->getY(), $block->getZ()), new Air);
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $block is an instance of Vector3 (Block extends Position extends Vector3), so you can just pass $block directly instead of creating a new Vector3 :)
    PHP:
    $block->getLevel()->setBlock($block, new Air);

Share This Page

Advertisement