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

SpazzyTp

Comments in 'Plugin Development' started by Skullex, Jan 22, 2016.

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

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I have made an error somewhere in this code. I need help fixing it

    PHP:
    <?php

    namespace Spazzy;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\entity\EntityTeleportEvent;
    use 
    pocketmine\level\particle\PortalParticle;
    use 
    pocketmine\level\sound\EndermanTeleportSound;

    class 
    Main extends PluginBase implements Listener{

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

        public function 
    onLoad(){
            
    $this->getLogger()->info("SpazzyTp §aenabled");
        }

        public function 
    onTeleport(EntityTeleportEvent $event){
            
    $entity $event->getEntity();
            
    $fizz = new EndermanTeleportSound($entity);
            
    $particle = new PortalParticle($entity)
            
    $entity->getLevel()->addSound($fizz);
            
    $entity->getLevel()->addParticle($particle);
        }
    }
        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args){
            switch(
    $command->getName()){
                case 
    "spazzy":
                    if(
    $sender instanceof Player){
                        
    $playerX $sender->getX();
                        
    $playerY $sender->getY();
                        
    $playerZ $sender->getZ();

                        
    $outX=round($playerX,1);
                        
    $outY=round($playerY,1);
                        
    $outZ=round($playerZ,1);

                        
    $playerLevel $sender->getLevel()->getName();

                        
    $sender->sendMessage("§ax:" $outX ", §ey:" $outY ", §9z:" $outZ ". §bOn:§d " $playerLevel);
                        return 
    true;
                    }

                    else{
                        
    $sender->sendMessage("§cThis command only works §ein§f-§egame.");
                }
            }
        }   

      
        public function 
    onDisable(){
            
    $this->getLogger()->info("SpazzyTp §cdisabled.");
            return 
    true;
        }
    }
    Im a work in progress, I need more corrections. :(
  2. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I received this error apon attempting to phar the compressed plugin :(

    Attached Files:

  3. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    You forgot semicolon ( ; ) in your
    PHP:
    $particle = new PortalParticle($entity)
  4. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    TY
  5. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I still get the same error :( 1 bad php files Main.php
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    PHP:
    public function onTeleport(EntityTeleportEvent $event){
    $entity $event->getEntity();
    $fizz = new EndermanTeleportSound($entity);
    $particle = new PortalParticle($entity);
    $entity->getLevel()->addSound($fizz);
    $entity->getLevel()->addParticle($particle);
    }
    }
    //EXTRA CLOSE BRACKET!!! this is a misake
    applqpak and Skullex like this.
  7. MichaelM04
    Offline

    MichaelM04 Active Member Plugin Developer

    Joined:
    Nov 12, 2015
    Posts:
    213
    Plugins:
    1
    Minecraft User:
    Michael
    semicolons and close brackets seem to be the biggest mistake people make in php :p
    applqpak, Skullex and PocketKiller like this.
  8. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    TY SO MUCH <3
  9. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    ... Notepad++, true?
    Skullex likes this.
  10. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    another good hint... download it anyway... open it in your server, and see the error that comes out.
    but since you've done it... its all gooooooooood.
    applqpak and Skullex like this.
  11. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    the error on the server is normally got more explination
    iDirtPlayzMC, applqpak and Skullex like this.
  12. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Yeah, but I fixed it :3
  13. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    so its all gooooooooooood then xD
    Skullex likes this.
  14. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Yipp xD
  15. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Realy, semicolon and brackets :) I HATE them!
    (Imagine you have an if construction with over 100 ifs in it! And then you get some error AT THE END OF THE FILE (LastLine) and then you try to fix the brackets It took me 1 hour lol)
  16. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Lol
  17. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo

    But if your ocd, youll hate the quote below.

    what i mean by this, is a simple way of errors in php... when we dont use any symbols st the end, or use the wrong symbol all together...
    Last edited: Jan 22, 2016
    applqpak and Skullex like this.
  18. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Evil
    TheDeibo likes this.
  19. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    thats meeee :p evel, but efficient.
    Skullex likes this.
  20. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    back ontopic.... your plugin sounds fun! please please please upload it to the plugins list.
    applqpak and Skullex like this.
Thread Status:
Not open for further replies.

Share This Page

Advertisement