[solved]Player short name?

Discussion in 'Plugin Development' started by herghost, Dec 19, 2011.

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

    herghost

    Hi all

    How do you get a player by a shorterned name? ie my minecraft name is herghost, but generally herg will work?

    Cheers
    Dave
     
  2. Offline

    halley

    I believe if you use Bukkit.getServer().getPlayer("herg") it should find herghost if herghost is currently online. If you don't want that behavior, then use .getPlayerExact() or .getOfflinePlayer(). Note that .getOfflinePlayer() will always return an OfflinePlayer object, creating one if necessary, so be vigilant and check if the returned player.hasPlayedBefore().

    Once you have a player object, always use player.getName() or player.getDisplayName() instead of whatever sloppy abbreviation the plugin user decided to type.
     
  3. Offline

    herghost

    I think I worded the question wrong but the answer will do :) Many thanks!
     
Thread Status:
Not open for further replies.

Share This Page