1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Error syntax

Discussion in 'Plugin Help' started by armagadon159753, May 22, 2017.

  1. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    I have make a small plugin but i have problem With funtion

    Main.php:
    https://ghostbin.com/paste/vebjx
    ( sorry i m noob. I have started to learn php since 3days °^° )
     

    Attached Files:

  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    This fixes it
    PHP:
    <?php

    namespace KiT;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat as C;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\permission\Permission;
    use 
    pocketmine\item\item;
    use 
    pocketmine\inventory\BaseInventory;
    use 
    pocketmine\item\enchantment\Enchantment;
    use 
    pocketmine\command\ConsoleCommandSender;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\event\player\PlayerInteractEvent;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\level\sound\{
     
    TNTPrimeSound
    };

    class 
    Main extends PluginBase implements Listener{
       
             public function 
    onLoad(){
                        
    $this->getLogger()->info("Plugin Loading");
              }
              public function 
    onEnable(){
                        
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
                
    $this->getLogger()->info("Enabled Plugin");
              }
              public function 
    onDisable(){
                        
    $this->getLogger()->info("Plugin Disabled");
              }
              public function 
    onJoin(PlayerJoinEvent $event){
               
    $player $event->getPlayer();
               
    $name $player->getName();
               
    $this->getServer()->broadcastMessage(C::GREEN."$name Joined The Server! Awesome!");
              }
              public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
                switch (
    $command->getName()) {
                    case 
    'kit':
                        
    $sender->getInventory()->addItem(Item::get(38801));
                        
    $sender->sendPopup('kit du demon');
                        break;
                        }
                    }
       
              public function 
    onTouch(PlayerInteractEvent $event){
                
    $player $event->getPlayer();
                
    $name $player->getName();
                    if(
    $player->getInventory()->getItemInHand()->getId() == 388) {
                      
    $set1 Item::get(31001);
                      
    $set2 Item::get(31101);
                      
    $set3 Item::get(31201);
                      
    $set4 Item::get(31301);
                      
    $set5 Item::get(27601);
                      
    $set6 Item::get(466016);
                      
    $player->getInventory()->removeItem(Item::get(388,0,1));
                      
    $player->getLevel()->addSound(new TNTPrimeSound(new Vector3($player->x,$player->y,$player->z)));
              }
     
  3. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    Thx ^•^ but an orther error in last line
     

    Attached Files:

  4. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    I think you just need another } at the end of the file.
     
    Sandertv likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.