getting display names

Discussion in 'Plugin Development' started by 1337, Jan 17, 2011.

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

    1337

    i would like to know how to get the player who used a commands display name and store it as a string,
    getDisplayname(); does not work for me, i would also like to know how to send messgaes to that player and how to send them to the whole server thank you
     
  2. Offline

    CompuIves

    Use
    Code:
    player.getName()
    If you assigned player like this:
    Code:
    Player player = event.getPlayer();
    Correct me if I'm wrong,
     
  3. Offline

    1337

    that worked but how do i send messages to that player and the server? thanks
     
  4. Offline

    Silence

    Code:
    player.sendMessage("A message");
     
  5. Offline

    1337

    thanks but how do i send messages to the whole server (evrybody connected)
     
  6. Offline

    Silence

    Code:
    getServer().broadcastMessage("My message to all");
    You might really want to read the docs...
     
  7. Offline

    DjDCH

    I support.
     
  8. Offline

    1337

    what docs?
     
  9. Offline

    1337

    ah thanks
     
  10. Offline

    Archelaus

    I'm fairly sure I gave you information on the broadcastMessage(); yesterday?
     
  11. Offline

    1337

    you did but it didnt work. also is there a way to check if a message contains a certain word and change just that word? Iknow how to get and set player messages but i was to check the message for certain words and just replace that word
     
  12. This forum is for support developing plugins, not learning basic Java. A quick visit to your favourite search engine will yield the answers you are looking for.
     
  13. Offline

    Archelaus

    Code:
            String name = "derpderpderp";
            if (name.indexOf("derp") != -1) {
                System.out.println("Herp derp?");
            }
            else {
                System.out.println("Cannae find derp");
            }

    I also gave you the way to do it. I gave you "broadcastMessage(string);". It works perfectly, you just need to know how to use it.
     
Thread Status:
Not open for further replies.

Share This Page