Send a message to players with a certain permission node?

Discussion in 'Spigot Plugin Development' started by Livaco, May 31, 2017.

  1. Hey,

    I was just wondering if its possible if a player has a permission node, if its triggered to send them to message, and if they dont have it do nothing. I've been searching for about half an hour and i cant find anything about it.

    Thanks!
     
  2. Assuming you trigger it when something happens and its not an event where one single player is singled out.

    Code (Text):
    Pesudocode;

    for (Player player : PlayersOnline) {
       if (player.hasPermission("permission.a") {
          player.sendMessage("Message");
        }
    }
     
    • Agree Agree x 4
  3. At least post the line.
     
  4. Code (Text):
    public static int broadcast(String message, String permission)
     
  5. You can't just copy it directly out of the javadoc lol. That javadoc page is for the Bukkit class, and the method in that class is broadcast(String, String). Since it's a static method, you don't need an instanceof the Bukkit class, so just put the two together: Bukkit.broadcast(stuff, stuff2)
     
    #8 iPyronic, Jun 1, 2017
    Last edited: Jun 1, 2017
  6. oh ok, im a idiot lol
     
  7. #10 ExpDev, Jun 1, 2017
    Last edited: Jun 1, 2017
    • Informative Informative x 3