Solved .getPlayer(string) is deprecated, what should I do?

Discussion in 'Plugin Development' started by HeroWorkbrine, Jul 3, 2014.

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

    HeroWorkbrine

    The Bukkit.getPlayer(string) and Bukkit.getServer.getPlayer(string) functions are deprecated. Is there a different function to get a player via it's name?
     
  2. Offline

    Krymonota

    Bukkit#getPlayer(String) is deprecated, but you can still use it. If you don't want to use this method, fetch the UUID of a player (there are some APIs) and use Bukkit#getPlayer(UUID).
     
  3. Offline

    RawCode

    you shoud read javadocs and news and few threads on forum.

    using search also valid action.
     
  4. Offline

    desht

    It's perfectly fine to use getPlayer(String) if you just need to get an online player by name; e.g. if you're implementing some kind of command which takes a player name as an argument ("/zap <player-name>").

    The method is deprecated to draw attention to the fact that player names (as opposed to player UUID's) should not be used as a long-term storage key, since Mojang will soon be allowing players to change their names.
     
  5. Offline

    HeroWorkbrine

    Thanks for all the replies! But I think I got the most help from this guy:
    I'm not really making a command, but
    I am not using player names as storage, so that means I'm just using them fine, I guess?
     
  6. Offline

    dsouzamatt

    It's still good practice to begin using UUIDs over string player names whenever possible.
     
  7. Offline

    Necrodoom

    dsouzamatt while not breaking existing functionality, should say.
     
Thread Status:
Not open for further replies.

Share This Page