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

My plugin has crashed

Discussion in 'Development' started by dragonflex, Mar 1, 2017.

  1. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    Hi! MY CODE IS CRASHED
    This code
    PHP:
    <?php
    namespace EssentialsPE\Commands\Home;

    use 
    EssentialsPE\BaseFiles\BaseAPI;
    use 
    EssentialsPE\BaseFiles\BaseCommand;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;
    use 
    pocketmine\utils\TextFormat;
    use 
    onebone\economyapi\EconomyAPI;

    class 
    Home extends BaseCommand{
        
    /**
         * @param BaseAPI $api
         */
        
    public function __construct(BaseAPI $api){
            
    parent::__construct($api"home""Teleport to your home""<name>"false, ["homes"]);
            
    $this->setPermission("essentials.home.use");
        }

        
    /**
         * @param CommandSender $sender
         * @param string $alias
         * @param array $args
         * @return bool
         */
        
    public function execute(CommandSender $sender$alias, array $args): bool{
            if(!
    $this->testPermission($sender)){
                
    $home $this->plugin->config->get("HomeCost");
                return 
    false;
            }
            if(!
    $sender instanceof Player || count($args) > 1){
                
    $this->sendUsage($sender$alias);
                return 
    false;
            }
            if(
    count($args) === 0){
                if((
    $list $this->getAPI()->homesList($senderfalse)) === false){
                    
    $sender->sendMessage("§c • Nie posiadasz teleportów na dom • ");
                    return 
    false;
                }
                
    $sender->sendMessage("§a • Twoje teleporty na dom - " $list  " • ");
                return 
    true;
            }
            if(!(
    $home $this->getAPI()->getHome($sender$args[0]))){
                
    $sender->sendMessage(TextFormat::RED "[Error] Home doesn't exists or the world is not available");
                return 
    false;
                }
             elseif(
    $r EconomyAPI::getInstance()->reduceMoney($player$home)) {
            
    $sender->teleport($home);
            
    $sender->sendMessage("§a • Teleportowałeś się • ");
            return 
    true;
                                  } else {
                           
                            switch(
    $r){
                                case 
    EconomyAPI::RET_INVALID:
                                    
    $sender->sendMessage("§c • Nie posiadasz - ($home) monet • ");
                                    break;
            }
        } 
    }
    Please edit and crash message in down
     

    Attached Files:

  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    syntax error
     
  3. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    You repare this syntex error code for me?
     
  4. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    Which is line 59?
     
  5. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
    Add one more '}' at end
     
    dragonflex 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.