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

Effect Error

Comments in 'Plugin Development' started by CraftYourBukkit, May 8, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Since I use PocketMine 1.5 the $effect->setVisible(); doesn't work. Here's the Crash:


    Code:
    PocketMine-MP Crash Dump Fri May 8 15:10:51 CEST 2015
    
    Error: Call to a member function setVisible() on null
    File: /LobbySystem/src/BukkitPlaysMC/LobbySystem/Main
    Line: 31
    Type: E_ERROR
    
    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: LobbySystem v1.0.0
    
    Code:
    [22]               
    [23]                 if($player->hasPermission("VIP.lobby") || $player->isOp()){
    [24]                     $player = $event->getPlayer();
    [25]                     $effect = Effect::getEffect($this->getConfig()->get("VIP.ID"));
    [26]                     if($effect instanceof InstantEffect){
    [27]                        $effect->setDuration($this->getConfig()->get("VIP.Duration"));
    [28]                        $effect->setAmplifier($this->getConfig()->get("VIP.Amplifier"));
    [29]                        $player->addEffect($effect);
    [30]                     } else{
    [31]                     $effect->setVisible($this->getConfig()->get("VIP.Particles"));
    [32]                     $effect->setDuration($this->getConfig()->get("VIP.Duration"));
    [33]                     $effect->setAmplifier($this->getConfig()->get("VIP.Amplifier"));
    [34]                     $player->addEffect($effect);
    [35]                     }
    [36]                     $effect2 = Effect::getEffect($this->getConfig()->get("Normal.ID"));
    [37]                     if($effect2 instanceof InstantEffect){
    [38]                         $effect2->setDuration($this->getConfig()->get("Normal.Duration"));
    [39]                         $effect2->setAmplifier($this->getConfig()->get("Normal.Amplifier"));
    [40]                         $player->addEffect($effect2);
    [41]                     } else{
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Config VIP.ID has a value such that when passed to Effect::getEffect() doesn't work.
    Please note that Effect::getEffect() accepts an integer not a string. If you want to use the name, use Effect::getEffectByName() instead.
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    It isn't a String, Config(default):
    Code:
    Normal:
      ID: 1
      Particles: false
      Duration: 107374182
      Amplifier: 1
    VIP:
      ID: 8
      Particles: false
      Duration: 107374182
      Amplifier: 1
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It should be getNested() not get(). Only getNested() explodes the periods (.).
    CraftYourBukkit likes this.
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Thanks, I will try it later!:)
  6. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    It works, thanks:)
    PEMapModder likes this.
  7. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Do the particles show up?
  8. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Nop
  9. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    I can't seem to get that to work.
  10. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    I'm using the latest PM Build, maybe that helps you
  11. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    I'll update to latest and see if it works.

Share This Page

Advertisement