Solved Bukkit.getPlayer(args[0])?

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

  1. I'm trying to make a rewrite of a plugin but I'm having a strange issue.

    Player target = Bukkit.getPlayer(args[0]);

    When I do the command (it's a heal command) with an argument (I have some handler code for no args and not player) being my name, it heals. I'm the only one who joined this test server. So I try to do /heal ramidzkh (not my IGN). For some heason, it heals me. I'm VERY sue that my code works.
    Can anyone twll me my problem

    Help pls.PNG
     
  2. Has that been your IGN name in the past? If so, that may be why it still returns you (since legacy plugins that use names and not UUIDs still function to some extent - even after a name change).
     
  3. getPlayer will get the first player it finds where the start of the player name matches the argument. If you want an exact match use getPlayerExact
     
  4. Works like how you would expect it :)
     
  5. Could you mark the thread as solved?
     
    • Agree Agree x 1