Broadcasting a commands boolean

Discussion in 'Plugin Development' started by Giorgio, Dec 3, 2012.

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

    Giorgio

    My Question is when a players sends a message, /msg <message>.

    How would I Broadcast the players message to the world? I mean i know how to broadcast Messages using a single Boolean, but not grabbing the players second Boolean and broadcasting it.

    NOTE: I'm more of a Visual Learner
     
    cigagar likes this.
  2. Offline

    Barinade

    Dudewut.... Second boolean?

    You trying to send false facts to your players, boy? :p
    Boolean means yep/nope (or true/false if you aren't a fun person)
    Are you asking how to send all the arguments of the command?
    In your terms, /msg boolean1 boolean2
    It broadcasts boolean1 but not boolean2
    Even though they aren't booleans. They're strings.

    String s = "";
    for (int i=0;i<args.length;i++) {
    s = s + args + " ";
    }
    sender.getServer().broadcastMessage(s);
     
  3. Offline

    Giorgio

    huh? lol im now really confused on what your saying...
     
  4. Offline

    Barinade

    You're tellin' me!

    Can you try to explain what you are trying to do a little better?
     
  5. Offline

    Sheepii

    You're not looking for booleans. Do you mean, you want to capture what they're saying? if so, you want to look at PlayerCommandPreprocessEvent Capture the command, capture the arguments and then Bukkit.broadcast("/tell" +args).
     
  6. Offline

    fireblast709

    StringBuilder is a lot faster than concatenation
    Code:java
    1. StringBuilder sb = new StringBuilder();
    2. for(String arg : args)
    3. {
    4. sb.append(arg);
    5. }
    6. Bukkit.broadcastMessage(sb.toString());
     
Thread Status:
Not open for further replies.

Share This Page