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

FIXED

Comments in 'Plugin Development' started by JassperBeastHD, Nov 12, 2013.

  1. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    FIXED BY 99leonchang
    Last edited: Nov 14, 2013
  2. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Thus only for a Server called SBP
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You need to change issuer to data when using an event. Then to get the player go to $data["player"]. Here is the fixed code:
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=JoinMessage
    version=1.0.0-BETA
    author=JassperBeastHD
    class=message
    apiversion=10
    */
    class message implements Plugin
    {
    private 
    $api;
    public function 
    __construct(ServerAPI $api$server false)
    {
    $this->api $api;
    }
    public function 
    init()
    {
    $this->api->addHandler("player.join", array($this"handler"), 5);
    $this->api->addHandler("player.respawn", array($this"handler"), 5);
    }
    public function 
    __destruct(){
    }
    public function 
    handler($data$event){
    $player $data["player"];
    switch(
    $event){
    case 
    "player.join":
    $player->sendChat("====[SBP Server]====\nWelcome @player to SBP Server\n-Owner=XxSilentBeastxX_\n-Youtube=XxSilentBeastGamerxX\n-Co-Owner=JassperBeastHD\n-Youtube=JassperBeastHD\n====[SBP Server]====\n");
    break;
    case 
    "player.respawn":
    $player->sendChat("====[Death Message]====\n-You died\n-To bad you lose your stuff\n-Make sure to get your stuff back\n====[Death Message]====\n");
    break;
    }
    }
    }
    I'm pretty tired though and could be wrong :)
  4. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    How about $issuer = $data["player/issuer"]
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yes you could do that, but it would be $data["player"]
  6. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Doesnt work say illegal something
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Could you tell me what it says is illegal?
  8. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    let me check console.log
  9. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    ERROR] A level 2 error happened: "Illegal string offset 'player'" in "/mnt/sdcard/DroidPocketMine/src/API/PluginAPI.php(87) : eval()'d code" at line 25
  10. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Did you just use my code or did you change it?
  11. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Nope, test it, i use droidpocketmine to test plugin
  12. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Weird, I didn't know what's wrong with it, wait for someone more experienced
  13. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    I tried pc still no work the illegal thing come up maybe try player.spawn
  14. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    392
    $data is the player object itself, "player.join" and "player.respawn" doesn't return anything else other then the player object. So $player = $data
    Falk likes this.
  15. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    what o_O
  16. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Just change $player = $data["player"]; to $player = $data;
  17. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    It work but it doent show the message
  18. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Make sure you have $player->sendChat and not $issuer->sendChat
  19. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    IT IS!!! u test it!
  20. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I don't have much server access and the cloud server I manage is being stupid

Share This Page

Advertisement