Solved UnNick All

Discussion in 'Plugin Development' started by wowlover6877, Oct 21, 2012.

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

    wowlover6877

    I' trying to male a command where it un-nicknames all players on the server. This is the code I'm using:
    HTML:
    for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
                            onlinePlayers.setDisplayName(onlinePlayers.getName());
                            Bukkit.getServer().broadcastMessage(ChatColor.DARK_RED + sender.getName() + " - Removing everyones nicknames.");
                        }
    When I test the command this is what I do: With essentials I type /nick Bob, then i type /nickoff. It displays the "Removing everyones nicknames" message, but doesn't remove my nick name.
     
  2. Offline

    chaseoes

    Try it without Essentials.
     
  3. Offline

    wowlover6877

    Well, the point of the command is to remove nicknames that were made by essentials.
     
  4. Offline

    one4me

    Essentials sets the player's display name every time the player chats and I haven't messed with Essentials too much, but something like this should work.
    Code:
    Bukkit.getServer().broadcastMessage(ChatColor.DARK_RED + sender.getName() + " - Removing everyones nicknames.");
    for(Player p : Bukkit.getOnlinePlayers()) {
      Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "nick " + p.getName() + " off");
    }
     
    
     
    wowlover6877 likes this.
  5. Offline

    wowlover6877

  6. Offline

    CorrieKay

    Wow...

    Really? Seriously? If thats true, that sounds like it would conflict with a bunch of plugins lol.
     
Thread Status:
Not open for further replies.

Share This Page