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

Help with Mulitworld

Comments in 'Plugin Development' started by iFootball, Jun 9, 2014.

  1. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Hello,
    This is my first plugin. I decided to make a simple plugin that tells the player "Thank you for playing Spleef" when they die in the Spleef game. This is the code for it, but I don't know how to do it so it only makes the announcement when the player dies in the world "Spleef". Please help revised the code so it includes that,

    Thanks
    iFootball

    Here's the code
    PHP:
    <?php

    /*
    __PocketMine Plugin__
    name=Spleef
    description=Generates Spleef message
    version=1.0
    author=iFootball
    class=Mjyl1bHm
    apiversion=10
    */

        
    class Mjyl1bHm implements plugin{

        private 
    $api;

        public function 
    __construct(ServerAPI $api$server false){

            
    $this->api $api;

        }

        public function 
    init(){

            
    $this->api->addHandler("player.death", array($this"eventHandler"), 100);

        }
       
        public function 
    eventHandler($data$event)
        {
        switch(
    $event)
        {
            case 
    'player.death':

                
    $data['player']->sendChat("Thank you for playing Spleef!!");

            break;
        }

        }

        public function 
    __destruct(){

        }

    }
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    if($data["player"]->entity->level->getName() === "spleef")

    Darunia18 and iFootball like this.
  3. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Thank you"

Share This Page

Advertisement