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

Solved How To Remove Player Joined The Game Message

Comments in 'Plugin Development' started by FuxonPlayz, Feb 28, 2016.

  1. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    Hi.
    i made a very SimplePlugin

    This is The Code

    PHP:
    <?php
    namespace FuxonPlayz\StaveCraftJoinMessage;

    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player;
    use 
    pocketmine\event\server;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;

    class 
    Main extends PluginBase implements Listener{
      public function 
    onEnable(){
      
    $this->getServer()->getPluginManager()->registerEvents($this$this);  $this->getLogger()->info("StaveCraftJoinMessage is Enabled");
      }
    public function 
    onJoin(PlayerJoinEvent $event){
      
    $player $event->getPlayer();
      
    $name $player->getName();
      
    $this->getServer()->broadcastMessage("$name §l§1Joined §l§2♦ §l§1StaveCraft §l§2♦ ");
      }

    }
    And When i Join The Game i got This Problem in The attached files

    Can Please Anyone Tell me a Code To Remove The Yellow Join Message ?[/PHP]

    Attached Files:

    Last edited: Feb 28, 2016
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    public function onJoin(PlayerJoinEvent $event){
    $event->setJoinMessage("");
    }
    Off-Topic: You should use TextFormat rather than Color-Codes.
    applqpak likes this.
  3. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    i'm noob at coding sorry :(
  4. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    The Error Not Resolved is There Problem in My Code ?
    PHP:
    <?php
    namespace FuxonPlayz\StaveCraftJoinMessage;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player;
    use 
    pocketmine\event\server;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    class 
    Main extends PluginBase implements Listener{
      public function 
    onEnable(){
      
    $this->getServer()->getPluginManager()->registerEvents($this$this);
      
    $this->getLogger()->info("§2StaveCraftJoinMessage is Enabled");
      }
    public function 
    onJoin(PlayerJoinEvent $event){
    $event->setJoinMessage("§e$name §l§9Joined §l§2♦ §l§1StaveCraft §l§2♦ ");
      }
     
    }
  5. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    nevermind i didn't reboot the server
  6. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    Can u Tell Me How To make
    PHP:
     $event->setJoinMessage("§e$name §l§9Joined §l§2♦ §l§1StaveCraft §l§2♦ "); 
    editable in config.yml
  7. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    for example a typed in the config.yml
    $name Joined The Cool Server
    then the code will change will change to
    PHP:
     $event->setJoinMessage("$name Joined The Cool Server"); 
  8. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Config.yml:
    Code:
    string: {name} joined this server!
    
    Script:
    PHP:
    $event->setJoinMessage(str_replace("{name}"$event->getPlayer()->getName(), $this->getConfig()->get("string")));
    applqpak likes this.
  9. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    Thx I will release a plugin soon :D
    HotFireyDeath likes this.
  10. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
  11. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    i got this error
    PHP:
     critical"Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'CustomServerJoinMessage v1.0': Argument 1 passed to pocketmine\utils\Config::setDefaults() must be of the type array, boolean given, called in phar://C:/Users/Abdulaziz/Desktop/ImagicalMine-PHP7/PocketMine-MP.phar/src/pocketmine/plugin/PluginBase.php on line 266 on FuxonPlayz\CustomServerJoinMessage\Main
    [19:48:57] critical> TypeError: "
    Argument 1 passed to pocketmine\utils\Config::setDefaults() must be of the type array, boolean givencalled in phar://C:/Users/Abdulaziz/Desktop/ImagicalMine-PHP7/PocketMine-MP.phar/src/pocketmine/plugin/PluginBase.php on line 266" (EXCEPTION) in "/src/pocketmine/utils/Config" at line 379
  12. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    im noob at coding sorry
    im new in these things

    and i didn't learn php very good
  13. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    show up da code.
  14. FuxonPlayz
    Offline

    FuxonPlayz New Member

    Joined:
    Feb 16, 2016
    Posts:
    25
    Minecraft User:
    FuxonPlayz
    OK Take This
    PHP:
    <?php
    namespace FuxonPlayz\CustomServerJoinMessage;

    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player;
    use 
    pocketmine\event\server;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\utils\Config;

    class 
    Main extends PluginBase implements Listener{
      public function 
    onEnable(){
      
    $this->getServer()->getPluginManager()->registerEvents($this$this);
      
    $this->getLogger()->info("§aCustomServerJoinMessage is Enabled");
      }
    public function 
    onJoin(PlayerJoinEvent $event){
      
    $player $event->getPlayer();
      
    $name $player->getName();
      
    $this->getServer()->broadcastMessage(str_replace("{name}",
      
    $this->getConfig()->get("JoinMessage")));
      
    $event->getPlayer()->getName();
      
    $event->setJoinMessage("");
      }
     
    }
  15. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    That error appears to be completely unrelated to my code provided, or the one you provided:
    PocketKiller and applqpak like this.

Share This Page

Advertisement