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

spawn lightning

Comments in 'Plugin Development' started by Creeperface, Oct 10, 2015.

  1. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Lighting is now my fav :D
  2. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    This is a cool idea. I tried both of these and they work fine but can you make so the lighting only works when a player logs in and not when the player moves?
  3. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    instead of
    PHP:
    onMove(PlayerMoveEvent $event){
    just do

    PHP:
    onJoin(PlayerJoinEvent $event){
    Legoboy0215 likes this.
  4. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Tried it but I get this error on start up - [Server thread/CRITICAL]: ReflectionException: "Class primus\t\handler\PlayerJoinEvent does not exist" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager" at line 724
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Sigh...
    use pocketmine\event\player\PlayerJoinEvent;
    thebigsmileXD and zombie_Power like this.
  6. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    PHP:
    namespace light;

    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\entity\Entity;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\network\protocol\AddEntityPacket;

    class 
    Lightning extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }

        public function 
    onJoin(PlayerJoinEvent $e){
            
    $p $e->getPlayer();
            
    $light = new AddEntityPacket();
            
    $light->type 93;
            
    $light->eid Entity::$entityCount++;
            
    $light->metadata = array();
            
    $light->speedX 0;
            
    $light->speedY 0;
            
    $light->speedZ 0;
            
    $light->$p->x;
            
    $light->$p->y;
            
    $light->$p->z;
            
    $p->dataPacket($light);
        }
    }
    Last edited: Oct 29, 2015
  7. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Won't load for me, I'm sure i'm doing something wrong.
  8. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    did you create a plugin.yml?
  9. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Do I need to if its a php file?
  10. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    download this file

    not tested.

    Attached Files:

  11. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Getting this error - [02:47:43] [Server thread/ERROR]: Could not load 'C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\light.phar' in folder 'C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\': Undefined index: api
  12. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Try this one.

    Attached Files:

  13. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Getting this on player join -
    [03:37:03] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Test v1.0.0': Class primus\t\handler\Entity not found on primus\t\handler\EventListener
    [03:37:03] [Server thread/CRITICAL]: ClassNotFoundException: "Class primus\t\handler\Entity not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
  14. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Fixed.

    Attached Files:

    thebigsmileXD likes this.
  15. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    Now this -
    [03:47:35] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Test v1.0.0': Argument 1 passed to pocketmine\Server::broadcastPacket() must be of the type array, object given, called in C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\test.php on line 73 and defined on primus\t\handler\EventListener
    [03:47:35] [Server thread/NOTICE]: InvalidArgumentException: "Argument 1 passed to pocketmine\Server::broadcastPacket() must be of the type array, object given, called in C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\test.php on line 73 and defined" (E_RECOVERABLE_ERROR) in "/src/pocketmine/Server__32bit" at line 1805
    [03:47:35] [Server thread/INFO]: Baby_PenguinxD joined the game.
    [03:47:35] [Server thread/INFO]: [TC] Server will restart in 60 mins.
    [03:47:44] [Server thread/INFO]: BobbyTowers[/73.49.36.198:61768] logged in with entity id 7 at (world, 6.6171, 4, -6.9021)
    [03:47:45] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Test v1.0.0': Argument 1 passed to pocketmine\Server::broadcastPacket() must be of the type array, object given, called in C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\test.php on line 73 and defined on primus\t\handler\EventListener
    [03:47:45] [Server thread/NOTICE]: InvalidArgumentException: "Argument 1 passed to pocketmine\Server::broadcastPacket() must be of the type array, object given, called in C:\Users\Bobby-Foo\Documents\MCPE SQL\plugins\test.php on line 73 and defined" (E_RECOVERABLE_ERROR) in "/src/pocketmine/Server__32bit" at line 1805
  16. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Omg hope this works.

    Attached Files:

  17. BobbyTowers
    Offline

    BobbyTowers Active Member

    Joined:
    Jun 4, 2015
    Posts:
    41
    Minecraft User:
    BobbyTowers
    @Primus Thank you so much it works!
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    That happened to me. broadcastPacket is kinda weird...
  19. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    Can I have a full version one? the one that really work and in .phar please xP
  20. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Suggestion: use $player->getViewers() for first argument.
    Legoboy0215 and iDirtPlayzMC like this.

Share This Page

Advertisement