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

WHY THIS NOT WORK?

Comments in 'Plugin Development' started by dragonflex, Dec 14, 2013.

  1. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    Why this no work?
    Plugin doesn't loaded


    PHP:
    class beAreaSeller implements Plugin
    {
        private 
    $api;
     
        public function 
    __construct(ServerAPI $api$server false)
        {
            
    $this->api $api;
        }
     
        public function 
    init()
        {

            
    $this->api->addHandler("tile.update", array($this"handler"));
            
    $this->api->addHandler("player.block.touch", array($this"handler"));
        }
     
        public function 
    __destruct()
        {
         
        }
     
        public function 
    chatTo($player$chat)
        {
            
    $player->sendChat("[beAreaSeller]" $chat);
        }
     
        public function 
    handler($data$event)
        {
            switch( 
    $event )
            {
                case 
    "tile.update":
                    
    $target $data;
                 
                    if(
    $target->class == TILE_SIGN)
                    {
                        if( 
    strtolower($target->data["Text1"]) == "beareaseller" )
                        {
                            if( !
    $this->api->dhandle("be.monitor.sellspace.exist", array( 'x' => $target->x'y' => $target->y'z' => $target->)) )
                            {
                                
    $player $this->api->player->get$target->data["creator"] );
                                if(
    $player !== false)
                                {
                                    
    $this->chatTo($player"Broken Area Seller, Please Remake It.");
                                }
                                return 
    false;
                            }
                        }
                    }
                    break;
                case 
    "player.block.touch":
                    
    $player $data["player"];
                    
    $target $data["target"];
                 
                    
    $tile $this->api->tile->get( new Position($target->x$target->y$target->z$target->level) );
                    if (
    $tile === false)
                    {
                        break;
                    }
                    
    $class $tile->class;
                    switch (
    $class)
                    {
                        case 
    TILE_SIGN:
                            if( 
    strtolower($tile->data['Text1']) == "beareaseller" )
                            {
                                
    $price = (int) $tile->data['Text2'];
                                
    $bmoney $this->api->dhandle("money.player.get", array( 'username' => $player->username ) );
                             
                                if(
    $bmoney $price)
                                {
                                    
    $this->chatTo($player"your money not enough for buy this area");
                                }
                                else
                                {
                                    if( !
    $this->api->dhandle("be.monitor.sellspace.exist", array( 'x' => $target->x'y' => $target->y'z' => $target->)))
                                    {
                                        
    $this->chatTo($player"Broken Area Seller, Contact to Admin");
                                    }
                                    else if( !
    $this->api->dhandle("money.handle", array( 'username' => $player->username'method' => 'grant''value' => -$price )) )
                                    {
                                        
    $this->chatTo($player"Error in Money Handleing");
                                    }
                                    else
                                    {
                                        if(    !
    $this->api->dhandle("be.monitor.sellspace.buy", array(
                                            
    'x' => $target->x,
                                            
    'y' => $target->y,
                                            
    'z' => $target->z,
                                            
    'buyer' => $player->username
                                            
    )))
                                        {
                                            
    $this->api->dhandle("money.handle", array( 'username' => $player->username'method' => 'grant''value' => $price ))
                                            
    $this->chatTo($player"Error in Area Handleing");
                                        }
                                        else
                                        {
                                            
    $this->chatTo($player"Area Purchased!");
                                        }
                                    }
                                }
                            }
                            break;
                    }
                    break;
            }
        }
     
    }

    ?>
    Last edited: Dec 14, 2013
  2. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    Something wrong on line 92 but idk what ...

    Code:
    $this->chatTo($player, "Error in Area Handleing");
  3. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    It should be $this->sendChat($player, "Error in Area Handling");
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Where is the variable $player defined?
  5. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    There seems to be more than one bugs in this :p
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The chatTo function looks fine from what I can see
  7. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    i dont think chatTo is even a function. am i wrong?
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yeah, it's a public function near the top of the plugin, it just adds the plugin message prefix to all messages it send to players. I also see the player variable definition now, can you give us the entire error?
  9. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /root/c/src/API/PluginAPI.php(87) : eval()'d code on line 117
    01:46:19 [ERROR] Failed loading plugin: evaluation error

    When i Changed
    This
    $this->chatTo($player, "Error in Area Handleing");
    To
    $this->sendChat($player, "Error in Area Handleing");
  10. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    It looks like the issue is somewhere above that line, also it's $player->sendChat
  11. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    Not work:
    Parse error: syntax error, unexpected '$player' (T_VARIABLE) in /root/c/src/API/PluginAPI.php(87) : eval()'d code on line 117
    02:12:34 [ERROR] Failed loading plugin: evaluation error
    :
  12. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    But on windows:
    Parse error: syntax error, unexpected '$player' (T_VARIABLE) in /root/c/plugins/TestPlugin.php : eval()'d code on line 117
    02:12:34 [ERROR] Failed loading plugin: evaluation error
  13. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    Go to line 117 and look for errors like a missing ; or something
  14. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The issue isn't in that line it's in one of the previous ones, likely the elseif statement
  15. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    117 line :
    $this->chatTo($player, "Error in Area Handleing");
  16. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    Where?
  17. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    Yah lol sorry I ment look around that area
  18. dragonflex
    Offline

    dragonflex Banned

    Joined:
    Oct 2, 2013
    Posts:
    65
    Minecraft User:
    dragonflex123
    I try make bearesignseller for bemonitor
    Can anyone help ?
  19. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    Moved thread to Plugin Development.
  20. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    $player = $issuer->username
    $player->sendChat

Share This Page

Advertisement