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

[Tutorial] Plugin Making 3

Comments in 'Plugin Development' started by EkiFoX, Mar 5, 2014.

  1. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    Handler:
    This is a very interesting thing that will allow you to perform some function when the player's actions.
    First, create a self handler:
    PHP:
    $this->api->addHandler("player.spawn", array($this"handle"), 5);
    player.spawn - event | array($this, "handle") - transmit event data to function | 5 - priority
    ---
    We have just added a command handler player.spawn!
    If a player already connected and entered the game we call the handler function that will handle the event.
    PHP:
    public function handle ($data$event){
    switch (
    $event) {
    case 
    "player.spawn":
       
    $this->api->chat->broadcast("Player ".$data->username." has joined the game!");
    }
    }
    Schedule:
    PHP:
    $this->api->schedule(1200, array($this"minuteSchedule"), array(), true);
    ...
    Last edited: Mar 5, 2014
    Killman2 likes this.

Share This Page

Advertisement