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

Help plz

Comments in 'Plugin Development' started by JassperBeastHD, Dec 23, 2013.

  1. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    PHP:
    <?php

    /*
    __PocketMine Plugin__
    name=NoDieNoLeftMessage
    version=2.0
    author=JassperBeastHD
    class=NoMsg
    apiversion=11
    */


    class NoMsg implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }
      
        public function 
    init(){
            
    $this->path $this->api->plugin->configPath($this);
            
    $this->loadFiles();  
            
    $this->api->addHandler('server.chat', array($this'serverchat'));
            
    $this->players = array();
        }
      
      
        public function 
    serverchat($data){
            
    $message $data->get();
            if(
    $this->config['DisableLeaveMsg'] == true){
                if(
    strpos($message'left the game')) return false;
            }
            if(
    $this->config['DisableJoinMsg'] == true){
                if(
    strpos($message'joined the game')) return false;
            }
            if(
    $this->config['DisableDieMsg'] == true){
                
    $dieMessages = array(' was killed by '' was killed'' was pricked to death'' tried to swim in lava'' went up in flames'' burned to death',
                                    
    ' suffocated in a wall'' drowned'' fell out of the world'' hit the ground too hard'' blew up'' died');
                foreach(
    $dieMessages as $string){
                    if(
    strpos($message$string)) return false;
                }
            }
          
    ERROR  ->>  public function loadFiles(){
            if(!
    file_exists($this->path.'config.yml')){
                
    $data = array(
                    
    'DisableLeaveMsg' => true,
                    
    'DisableDieMsg' => true,
                    
    'DisableJoinMsg' => true,
                );
                
    $this->api->plugin->writeYAML($this->path.'config.yml'$data);
            }
            
    $this->config $this->api->plugin->readYAML($this->path.'config.yml');
        }
      
        public function 
    __destruct(){}
    }
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Disabling death messages is probably possible, disabling join and leave messages are part of MCPE and can't be changed.
  3. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Actually, only join is part of MCPE, leave was implemented by PocketMine
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Wow, I didn't know that :)
  5. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Bubbll made it possible to disable join msg
  6. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    HELP ME! This spam server thats why im making it

Share This Page

Advertisement