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

[HELP]EVENTS

Comments in 'Plugin Development' started by jython234, Jan 1, 2014.

  1. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Well, how do you use them?
    I want to make a plugin when a player joins(the event) it displays some server news to them.

    - Jython234
  2. MegaSamNinja
    Offline

    MegaSamNinja Active Member

    Joined:
    Sep 13, 2013
    Posts:
    138
    Minecraft User:
    Bamuel
    Um you can change the server prorities
    Last edited: Jan 2, 2014
  3. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    I think there are already some plugins that display custom messages when a player joins the server. It might be called a message of the day or MOTD plugin, but I'm not exactly sure. If not, a list of events can be found on the PocketMine GitHub if you look in the Wiki section of it.
  4. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    I know that. I want to know how to use the events.
  5. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    53
    Minecraft User:
    MasonLovesMCPE
    I AM ASKING THIS EXACT SAME QUESTION!!!!!
  6. InusualZ
    Offline

    InusualZ Active Member Plugin Developer

    Joined:
    Aug 23, 2013
    Posts:
    218
    Plugins:
    1
    Minecraft User:
    Inusu4lZ
    1. You need to add a handler to event "player.join"
    2. You need to handle the event.
    3. You need to get the last new of the server.
    4. You need to send the last news to the player.
    5. Publish the plugin,
    6. Fix a bug of the plugin.
    7. Sleep entire day.
    8. Make another plugin.
  7. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    53
    Minecraft User:
    MasonLovesMCPE
    what is the actual code for doing this?
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    In src/Player.php you can find handle("player.spawn", $this)
    Player.connect is when the client detects the server and is trying to build the connection. The server has yet sent nothing to the client.
    Player.join is when the client shows the classic "Generating world \n Building terrain". At that time the player passed the ban and banip test
    Player.spawn is when the entoty of the player is created and all players read the broadcast "<server> @player joined the game"
    Player.death is when the player sees the infamous "You died!" message and the two buttons
    Player.respawn is when the player entity is regenerated at the spawnpoint
    Therefore you can:
    1. In somewhwre, recommendedly init(),
    PHP:
    $api->addHandler("player.spawn", array($this"onJoined"));
    2. Create the handler as specified in the callable
    PHP:
    public function onJoined($playwr){

    }
    3. Add the code $player->sendChat($motd); in to the function

    Like thisbif I helped
    Last edited: Jan 10, 2014
    jython234 and Mason Gareis like this.
  9. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    List of events?
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement