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.
Some code: PHP: public function... Blah Blah Blah...{ $rewit=rand(1,2); if($rewit = 1){ $reward==new Item(Item::get(rand(1,4), 0, rand(1,32))); } if($rewit = 2){ $reward==new Item(Item::get(5, rand(0,5), rand(0,32))); } $event->getBlock()->getLevel->setBlock(new Air); $event->getBlock()->getLevel->dropItem($reward);}
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), 0, mt_rand(1,32))); } if($rewit == 2){$reward = new Item(Item::get(5, mt_rand(0,5), mt_rand(0,32))); } Try my code.
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?
Okay. PHP: $rewit=mt_rand(1,2); switch($rewit){ case 1: $reward = Item::get(mt_rand(1,4), 0, mt_rand(1,32)); break; case 2: $reward = Item::get(5, mt_rand(0,5), mt_rand(0,32)); break; }
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
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);
$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);