Send message to all operators

Discussion in 'Plugin Development' started by cheese5505, Jan 14, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    cheese5505

    Is it possible/how do I send a message to all of the online op's?
    So far I only have the list of the op's.
     
  2. Offline

    theguynextdoor

    Code:java
    1. for (Player player : Bukkit.getServer().getOnlinePlayers()) {
    2. if (player.isOp()) {
    3. //send your message
    4. }
    5. }
    Just one method, probably not the most efficient though
     
  3. Offline

    Jaker232

    Check your code. You may made a mistake. (Hint: A '}' mark is missing.
     
  4. Offline

    skore87

    Hehe, @theguynextdoor , you've been caught twice =)
     
  5. Offline

    theguynextdoor

    lol Dang it
     
  6. Offline

    cheese5505

    Thanks.
     
  7. another way you could probably do it, is to give your OP's specific permissions, and then getServer().broadcast(message, permission);
    it will send messages to those with only the listed permission
     
  8. shortest way:

    Command.broadcastCommandMessage(CommandSender source,String message)
     
  9. L
    Love you Fernando :)
     
Thread Status:
Not open for further replies.

Share This Page