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

Fly error

Comments in 'Plugin Development' started by Anonymous4life, Nov 25, 2015.

Thread Status:
Not open for further replies.
  1. Anonymous4life
    Offline

    Anonymous4life New Member

    Joined:
    Apr 9, 2015
    Posts:
    26
    Minecraft User:
    Anonymous4life
    this is seanmcpe' code but he isn't fixing it so I will. Can you help me fix it :) here is the problem:
    Code:
    Error: Call to undefined method pocketmine\Player::getCause()
    File: myzip:///SafeFly-master.zip#SafeFly-master/src/Sean_M/SafeFly/Main
    Line: 30
    Type: E_ERROR
    
    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: SafeFly v1.0.0
    
    Code:
    [21]         $this->getLogger()->info(TextFormat::GREEN . "SafeFly by Sean_M enabled!");
    [22]      }
    [23]
    [24]      public function onDisable() {
    [25]         $this->getLogger()->info(TextFormat::RED . "SafeFly by Sean_M disabled!");
    [26]      }
    [27] 
    [28]      public function onEntityDamage(EntityDamageEvent $event) {
    [29]         $entity = $event->getEntity();
    [30]         $damager = $entity->getCause();
    [31]         if($event instanceof EntityDamageByEntityEvent && $damager instanceof Player && $this->isPlayer($damager)) {
    [32]             $damager->sendTip(TextFormat::RED . "You cannot damage players while in fly mode!");
    [33]             $event->setCancelled(true);
    [34]         }
    [35]      }
    [36]
    [37]     public function onCommand(CommandSender $sender, Command $cmd, $label,array $args) {
    [38]         if(strtolower($cmd->getName()) == "fly") {
    [39]             if($sender instanceof Player) {
    [40]                 if($this->isPlayer($sender)) {
    
    Backtrace:
    #0 (): pocketmine\Server->crashDump(boolean)
    
    PocketMine-MP version: 1.6dev #0 [Protocol 38; API 1.13.0]
    Git commit: 0000000000000000000000000000000000000000
    uname -a: Linux Server.4LifeCraft.net 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64
    PHP Version: 5.6.10
    Zend version: 2.6.0
    OS : Linux, linux
    
    What should I do?
    Last edited: Nov 26, 2015
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Learn how to read errors.
    The correct code to get the damager is $event->getDamager();
  3. Anonymous4life
    Offline

    Anonymous4life New Member

    Joined:
    Apr 9, 2015
    Posts:
    26
    Minecraft User:
    Anonymous4life
    Only been like a week of learning PhP :/ anyway this was seanmcpe' code but thank you so much! I'll be able to learn all this soon :) wish me luck
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Good luck :p
  5. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
  6. Johnwhireez
    Offline

    Johnwhireez New Member

    Joined:
    Mar 25, 2016
    Posts:
    5
    Minecraft User:
    XxArrowCraftxX
    Do you have the download link to this plugin?
  7. Johnwhireez
    Offline

    Johnwhireez New Member

    Joined:
    Mar 25, 2016
    Posts:
    5
    Minecraft User:
    XxArrowCraftxX
    If it is I would still like it for development purposes so I can help him with it I can work with PhP7
  8. Johnwhireez
    Offline

    Johnwhireez New Member

    Joined:
    Mar 25, 2016
    Posts:
    5
    Minecraft User:
    XxArrowCraftxX
    Also I would pay money for it =D
    ImagicalGamer likes this.
  9. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    This is an old thread, we have fixed the plugin.
Thread Status:
Not open for further replies.

Share This Page

Advertisement