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

this is correct ?

Comments in 'Plugin Development' started by Praxthisnovcht, Nov 27, 2014.

  1. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    PHP:
        public function getFormattedMessage(Player $player$message) {
            
    $format $this->pgin->getConfig ()->get "chat-format" );
            
    // $format = "<{PREFIX} {USER_NAME}> {MESSAGE}";       
            
    $format str_replace "{WORLD_NAME}"$player->getLevel ()->getName (), $format );
           
            
    $nick $this->pgin->getConfig ()->get $player->getName () > ".nick");
            if (
    $nick!=null) {
                
    $format str_replace "{DISPLAY_NAME}"$nick$format );
            } else {
                
    $format str_replace "{DISPLAY_NAME}"$player->getName (), $format );           
            }
           
            
    $format str_replace "{MESSAGE}"$message$format );
           
            
    $level $player->getLevel ()->getName ();
           
            
    $prefix null;
            
    $playerPrefix $this->pgin->getConfig ()->get $player->getName ().".prefix" );
            if (
    $playerPrefix != null) {
                
    $prefix $playerPrefix;
            } else {
                
    //use default prefix
                
    $prefix $this->pgin->getConfig ()->get "default-player-prefix");
            }               
            if (
    $prefix == null) {
                
    $prefix "";
            }
            
    $format str_replace "{PREFIX}"$prefix$format );
            return 
    $format;
        }
        private function 
    log($msg) {
            
    $this->pgin->getLogger ()->info $msg );
        }
    }
    64FF00 likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
     $nick $this->pgin->getConfig ()->get $player->getName () > ".nick");
    Typo
    64FF00 likes this.
  3. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,201
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
  4. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    64FF00 likes this.

Share This Page

Advertisement