How to set a display name

Discussion in 'Plugin Development' started by sebagius7110, Sep 29, 2014.

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

    sebagius7110

    I, am trying to set a display name in my plugin, because I can't manage prefix's properly. So I just wanted to make this plugin to set specific prefix's, by doing

    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent e)
    3. {
    4. Player player = e.getPlayer();
    5. if(!player.isOP)
    6. {
    7. player.setDisplayName("§a[§fPlayer&a]§7 " + player.setDisplayName() + " §c:: §6");
    8. }
    9. }


    But it does not work, help?
     
  2. Offline

    techboy291

    isOp() is a method, not a variable. And any &(color code here) won't become a color, you have to just use §.
     
  3. Offline

    Skionz

    setDisplayName()? Lol
     
  4. Offline

    sebagius7110

    I fixed &7 to §7 all the rest were § from the beginning, but in the plugin all was §

    Whoops yeah, forgot about that, but in the code of my plugin was was set

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  5. Offline

    Skionz

  6. Offline

    Zombieghost_391

    Well if you try to separate players in to groups like team red and team blue or admin and member try this (P.S. This changes there name all the ways u can see it)
    Code:java
    1. public static Team team;
    2.  
    3. @Override
    4. public void onEnable() {
    5. team.setPrefix(ChatColor.GREEN + "");
    6. /**
    7.   * From there add the player to the team through a event like joinevent
    8.   * I didn't test but should work :D need help just reply
    9.   */
    10. }
     
  7. Offline

    97WaterPolo

    techboy291
    Unless the OP modified the code, his use of isOp() is correct? If it did get changed, as I see it was edited 3 times, my mistake.
     
  8. Offline

    sebagius7110

    ?, and also I did make a few mistakes on the thread because I didn't copy and paste the code, I rewrote it. But it still does not work.

    Is there a set prefix?! didn't know. I'll try that

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
Thread Status:
Not open for further replies.

Share This Page