Server.broadcastMessage error

Discussion in 'Plugin Development' started by Paradrakor, Jul 21, 2014.

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

    Paradrakor

    Hello, I looked at the javadocs to find a way to broadcast a message without doing /say <message>.

    This is my code for it:

    Code:text
    1.  
    2. Server.broadcastMessage(ChatColor.DARK_AQUA + "Player" + killer + "has received a 3-second Strength II boost for a 5 killstreak!"););


    I've imported Server (from org.bukkit, not Java). However, the whole line is underlined with the error message:

    "Cannot make a static reference to the non-static method broadcastMessage(String) from the type Server"

    I'm not sure what I did wrong, as this is the format on the JDs...
     
  2. Offline

    Saladoc

    You need to access the server singleton. A convenient way to do this is using Bukkit.broadcastMessage instead

    The Bukkit class is basically a shortcut to the server instance in use.
     
    Paradrakor likes this.
  3. Offline

    stormneo7

    Lol at the end of your line you did
    Code:java
    1. ););
     
  4. Offline

    fireblast709

    Paradrakor Server has no static methods, use the Bukkit class for static access
     
    Paradrakor likes this.
  5. Offline

    Paradrakor

    I just copy/pasted wrong
     
Thread Status:
Not open for further replies.

Share This Page