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

Broadcast Message ?

Comments in 'Plugin Development' started by Radix, Jul 30, 2015.

  1. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    Can I do ,
    PHP:
    elseif($this->getServer()->getPlayer($name)->isOnline())
    {
          
    $player->sendMessage(TextFormat::DARK_RED "§c§lDarkRealms >§8 Admin Warning: " $msg);
                   
    $sender->sendMessage(TextFormat::DARK_GREEN "§c§lDarkRealms >§8 " $player->getName() . " was warned.");
                   
    $this->warnedplayers->set($name);
                  
    $this->owner->getServer()->broadcastMessage($player->getName(). "Has been Warned!");
                   return 
    true;
                 }
  2. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    Don't use the Color Symbol (§) if you already used TextFormatting.
    ImagicalGamer and EvolSoft like this.
  3. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    Alright but will this
    PHP:
      $this->owner->getServer()->broadcastMessage($player->getName(). "Has been Warned!");
    Work for a broadcast to all players?
  4. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    From the code you've shown us, it appears that it should work. :rolleyes:
  5. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    Thank you dad <3
  6. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    Why don't you just try it...?
    GlaciercreepsMC likes this.
  7. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    No server to test on...
  8. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Lol
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    isOnline is a member function of the Player class. getPlayer returns either Player or null. If it returns null, you can't execute a method on it. You have to check it notnull first.
  10. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    Well the plugin worked so ...
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    When the Player of $name is offline? Not connected at all?
  12. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    A little bit off-topic. You're developing and you can't test what you make? :(
  13. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    Well I lied ,I have servers just lazzy

Share This Page

Advertisement