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. ItsSuka
    Offline

    ItsSuka Banned

    Joined:
    Nov 6, 2015
    Posts:
    13
    Minecraft User:
    Unknow
    Code for PlayerDeathEvent ?
  2. Radguy23
    Offline

    Radguy23 Active Member

    Joined:
    Aug 14, 2015
    Posts:
    74
    Minecraft User:
    TheAwesomeCrew27
    So is this like when a player joins or dies it spawns lightning? If not is there a command to spawn the lighting?
  3. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Use EntityDeathEvent
  4. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Only on join and command /strike <player>

    Attached Files:

  5. ItsSuka
    Offline

    ItsSuka Banned

    Joined:
    Nov 6, 2015
    Posts:
    13
    Minecraft User:
    Unknow
    Code plz ?
  6. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    PHP:
    public function onDeath(EntityDeathEvent $e){
    $p $e->getPlayer();
    $level $p->getLevel();
    $light = new AddEntityPacket();
    $light->type 93;
    $light->eid Entity::$entityCount++;
    $light->metadata = array();
    $light->speedX 0;
    $light->speedY 0;
    $light->speedZ 0;
    $light->yaw $p->getYaw();
    $light->pitch $p->getPitch();
    $light->$p->x;
    $light->$p->y;
    $light->$p->z;
    foreach(
    $level->getPlayers() as $pl){
    $p->dataPacket($light);
    }
    }
  7. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    This 100% wouldn't work
    getPlayer() is wrong, you should use:
    PHP:
    $p $event->getEntity();
    #ReadTheDocs
    HamIsGoodie and BalAnce like this.
  8. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Oh, i missed this, thats true
  9. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    PHP:
    foreach($level->getPlayers() as $pl){
    $p->dataPacket($light);
    }
    }
    And, $p should change to $pl
    :p $pl->dataPacket($light)
    HamIsGoodie likes this.
  10. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    PHP:
    public function onDeath(EntityDeathEvent $e){
    $p $e->getEntity();
    $level $p->getLevel();
    $light = new AddEntityPacket();
    $light->type 93;
    $light->eid Entity::$entityCount++;
    $light->metadata = array();
    $light->speedX 0;
    $light->speedY 0;
    $light->speedZ 0;
    $light->yaw $p->getYaw();
    $light->pitch $p->getPitch();
    $light->$p->x;
    $light->$p->y;
    $light->$p->z;
    foreach(
    $level->getPlayers() as $pl){
    $pl->dataPacket($light);
    }
    }
    Heres the fixed code
    But i dont think it will works.. Because i tried lot of code yesterday... All failed...
    HamIsGoodie likes this.
  11. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    I have a lot of "lightnings events" in my plugin and all works good :)
  12. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    It works for me lol
  13. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Legoboy, this (That code i posted to fix) code works?
    Or u use other code?
    HamIsGoodie likes this.
  14. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Yeah
  15. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Alright! im going to try it!! Yaaayyy
    *Have no potential to spam
    HamIsGoodie likes this.
  16. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Yep.
  17. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Nah.... dont work...
    What is your code?
    HamIsGoodie likes this.
  18. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Try this

    Attached Files:

  19. ItsSuka
    Offline

    ItsSuka Banned

    Joined:
    Nov 6, 2015
    Posts:
    13
    Minecraft User:
    Unknow
    Thank mann ...
  20. Artide
    Offline

    Artide Active Member

    Joined:
    Apr 20, 2015
    Posts:
    214
    Minecraft User:
    Artide5
    I got this from my server's core I'm making. lol.
    Code:
    /**
         * @param PlayerDeathEvent $e
         */
        public function onMove(PlayerDeathEvent $e){
            $p = $e->getEntity();
            if($p instanceof Player) {
                $cause = $p->getLastDamageCause();
                if($cause instanceof Player) {
                    $ex = new AddEntityPacket();
                    $ex->x = $p->x;
                    $ex->y = $p->y;
                    $ex->z = $p->z;
                    $ex->metadata = array();
                    $ex->type = 93;
                    $ex->eid = Entity::$entityCount++;
                    $p->dataPacket($ex);
                    $e->setDeathMessage(TXT::AQUA . "[PvP] " . TXT::GREEN . $p->getName() . TXT::AQUA . " lost against " . TXT::RED . $cause->getName() . TXT::AQUA . "...");
                }
            }
        }

Share This Page

Advertisement