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

Plugin Error.

Comments in 'Plugin Development' started by M4nt0s, May 25, 2016.

  1. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    Hey! I wrote a Plugin (My first Plugin) but there is an error. Who can help me?

    Attached Files:

  2. Mat
    Offline

    Mat Active Member Plugin Developer

    Joined:
    Jun 15, 2014
    Posts:
    179
    Plugins:
    1
    Minecraft User:
    matcracker
    Can you paste the code?
  3. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    namespace ASETeleport;

    use pocketmine\plugin\PluginBase;
    use pocketmine\utils\TextFormat;
    use pocketmine\Player;
    use pocketmine\command\CommandSender;
    use pocketmine\command\Command;
    use pocketmine\event\entity\ProjectileHitEvent;
    use pocketmine\event\Listener;
    use pocketmine\event\player\PlayerChatEvent;
    use pocketmine\event\player\PlayerInteractEvent;

    class main extends PluginBase implements Listener

    {

    public function onEnable(){
    $this->getLogger()->info("Das Plugin ASETeleport läuft ohne Probleme!");
    }
    public function onDisable(){
    $this->getLogger()->info("Das Plugin ASETeleport hat wohl einen Fehler!");
    }
    public function onTeleport(ProjectileHitEvent $event){
    $arrow = $event->getEntity();
    if($arrow instanceof Arrow){
    $player = $arrow->shootingEntity;
    if($player instanceof Player){
    $player->teleport($arrow);
    $player->sendMessage(TextFormat::GREEN."Deine Position wurdd verändert");
    }
    }
    }

    }
  4. Mat
    Offline

    Mat Active Member Plugin Developer

    Joined:
    Jun 15, 2014
    Posts:
    179
    Plugins:
    1
    Minecraft User:
    matcracker
    Mhmm... bad practice....
    Try this...

    PHP:
    $arrow $event->getEntity();
    if(
    $arrow instanceof Arrow){
        foreach(
    $arrow->getViewers() as $player){
             if(
    $player instanceof Player){
                  
    $player->teleport(new Position($arrow->getX(), $arrow->getY(), $arrow->getZ()));
                  
    $player->sendMessage(TextFormat::GREEN."Deine Position wurdd verändert");
             }
        }
    }

  5. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    OK, i try it. But what is on my code wrong?
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Player extends Position, there is no need to construct new Position instance.
  7. Mat
    Offline

    Mat Active Member Plugin Developer

    Joined:
    Jun 15, 2014
    Posts:
    179
    Plugins:
    1
    Minecraft User:
    matcracker
    Same $player->teleport($arrow->getPosition()); ?
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Yes and same with
    PHP:
    $player->teleport($arrow);
  9. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    I got an new Error....i unterstood that I forgot to make a array with loadMap ()

    Original Error: Could not load '/plugins/ASETeleport.phar' in folder '/plugins/': Argument 1 passed to pocketmine\plugin\PluginDescription::loadMap() must be of the type array, boolean given, called in phar:///jar/genisys_PHP7.phar/src/pocketmine/plugin/PluginDescription.php on line 53

    Where I have to place the loadMap() ?
  10. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    Have I miss the loadMap() array?
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Something is wrong with your plugin.yml
    Paste it here
  12. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    name: ASETeleport
    main: ASETeleport\Main
    version: 1.0.0
    api: 1.14.0
    author: M4nt0s
  13. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    I post it. What's wrong with the plugin.yml?
  14. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    name: ASETeleport
    main: ASETeleport\Main
    version: 1.0.0
    api: 1.14.0
    author: M4nt0s
  15. DroidWareWolf
    Offline

    DroidWareWolf New Member

    Joined:
    Dec 27, 2015
    Posts:
    4
    Minecraft User:
    DroidWareWolf
    Use API 2.0.0
  16. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    I done. But Error stay!
  17. BlubberBoy333
    Offline

    BlubberBoy333 Active Member

    Joined:
    Aug 31, 2014
    Posts:
    177
    Minecraft User:
    Blubberboy333
    Is that your entire plugin.yml file?
  18. M4nt0s
    Offline

    M4nt0s Active Member

    Joined:
    Sep 15, 2015
    Posts:
    49
    Minecraft User:
    M4nt0s
    Yes. There are no commands in this Plugin.

Share This Page

Advertisement