Offline Player

Discussion in 'Spigot Plugin Development' started by YouTube0099, Apr 19, 2017.

  1. How to find out if that player exists?

    Please help me!!
    • Agree Agree x 1
  2. Use the method hasPlayedBefore() (boolean) in PlayerPreLoginEvent
  3. Code (Text):
    if (Bukkit.getPlayer(playerName) == null) {
       sender.sendMessage("Player does not exist!");
    • Agree Agree x 1
    • Optimistic Optimistic x 1
  4. Thank you so much!
  5. False. This only checks if the players is online. Not if the player exists on the server.
  6. If so, what is the difference between Bukkit.getPlayerExact() and Bukkit.getPlayer()?
  7. Straight from the docs:

    getPlayer(String name)
    Gets a player object by the given username.

    getPlayer(UUID id)
    Gets the player with the given UUID.

    getPlayerExact(String name)
    Gets the player with the exact given name, case insensitive.
  8. Code (Text):
    if (Bukkit.getOfflinePlayer(playerName) == null) {
       sender.sendMessage("Player does not exist!");
  9. *sigh*
    • Like Like x 2