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

Parse Errors

Comments in 'Plugin Development' started by Skullex, Mar 19, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I went on GitHub and made a fork of DodgeBall and edited as I please in my own repository and now I keep getting this error... unexpected 'public' (T_PUBLIC) on line 52

    I use Brackets.io
    PHP:
    <?php

    /*
    * Editor: Skullex.. Skull3x
    */


    namespace Dodgeball;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\entity\ProjectileHitEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\event\player\PlayerDeathEvent;
    use 
    pocketmine\event\entity\EntityDamageByEntityEvent;
    use 
    pocketmine\event\block\BlockPlaceEvent;
    use 
    pocketmine\event\block\BlockBreakEvent;


    class 
    Main extends PluginBase implements Listener{
        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
            
    $this->getLogger()->info(TextFormat::GREEN "Dodgeball Minigame has been enabled successfully!");
        }
      
        public function 
    onJoin(PlayerJoinEvent $event) {
            
    $player $event->getPlayer();
            
    $name $event->getPlayer()->getName();
            
    $player->sendMessage(TextFormat::AQUA "> " TextFormat::GREEN "Welcome to " TextFormat::YELLOW TextFormat::BOLD ."StrongHold " TextFormat::RESET TextFormat::AQUA $name TextFormat::WHITE "!");
        }
      
        public function 
    onHit(ProjectileHitEvent $event){
            
    $entity $event->getEntity();
            if(
    $player->getLevel()->getName() === "DodgeBall" && $player->getLevel()->getName() === "Kwa's Plot Spawn") {
                
    $this->getLogger()->info(TextFormat::RED ."Someone has been eliminated in DodgeBall!");
                
    $event->getServer()->getLevel()->broadcastMessage(TextFormat::AQUA "> " TextFormat::RED $name TextFormat::YELLOW " has been eliminated in DodgeBall!");
                
    $event->getEntity()->setHealth(0);
            }
        }
          
            public function 
    onPlace(BlockPlaceEvent $event) {
                
    $player $event->getPlayer();
                if(!(
    $player->isOp)) {
                    if(
    $player->getLevel()->getName() === "DodgeBall" && $player->getLevel()->getName() === "Kwa's Plot Spawn") {
                        
    $event->setCancelled(true);
                    }
                }
              
                public function 
    onBreak(BlockBreakEvent $event) {
                    if(!(
    $player->isOp)) {
                        if(
    $player->getLevel()->getName() === "DodgeBall" && $player->getLevel()->getName() === "Kwa's Plot Spawn") {
                            
    $event->setCancelled(true);
                        }
                    }
                }
                            public function 
    onDeath(PlayerDeathEvent $event){
                                
    $cause $event->getEntity()->getLastDamageCause();
                                if(
    $cause instanceof EntityDamageByEntityEvent){
                                    
    $player $event->getEntity();
                                    
    $killer $cause->getDamager();
                                    
    $player $event->getEntity();
                                    if(
    $killer instanceof Player){
                                        
    $player->sendMessage(TextFormat::RED.$killer->getName() . TextFormat::RESET." ┬žekilled you with " .TextFormat::LIGHT_PURPLE.$killer->getHealth().TextFormat::GOLD." ┬žchearts left" .TextFormat::YELLOW."!");
                                        
    $killer->sendTIP(TextFormat::GREEN."You eliminated ".TextFormat::RED.$player->getName());
                                    }
                                }
                            }
            }
    }

    I need help with my work, thanks :)
    Last edited by a moderator: Mar 19, 2016
  2. Intyre
    Offline

    Intyre Staff Member PocketMine Team

    Joined:
    Aug 24, 2013
    Posts:
    118
    Minecraft User:
    Intyre
    Stop using the code/php tags from the forum. Use gist or anything that includes line numbers. It makes it easier to spot the error when the line number is given.
    PEMapModder, applqpak and Skullex like this.
  3. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Thank You!! Also I understand that, but the application I use has line numbers. I think it was me and my eyes :D
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You forgot a } at
    PHP:
    public function onPlace(BlockPlaceEvent $event) {
            
    $player $event->getPlayer();
            if(!(
    $player->isOp)) {
                if(
    $player->getLevel()->getName() === "DodgeBall" && $player->getLevel()->getName() === "Kwa's Plot Spawn") {
                    
    $event->setCancelled(true);
                }
            }
    PEMapModder likes this.

Share This Page

Advertisement