Storing UUID's

Discussion in 'Spigot Plugin Development' started by LazerShadow, Sep 5, 2015.

  1. Hello,

    I'm making a person plugin, and I am using a ranking system. When you do /rank <target> it stores the target's UUID in a HashMap

    Code (Java):
    public static HashMap<UUID, UUID> rankTarget = new HashMap<UUID, UUID>();
    Code (Java):
    rankTarget.put(_target.getUniqueId(), _player.getUniqueId());
    and then it opens an inventory where you can change their rank. I need to be able to get the target player but it only work when you are editing your own rank.

    Code (Java):
    Player target = Bukkit.getServer().getPlayer(RankCmd.rankTarget.get(player.getUniqueId()));
  2. What's wrong with that you have? xD

    Try adding debugging to all your code.
  3. Can we see the full class please?
  4. Whats the problem? Where is your code?
  5. What's wrong with it? :p
  6. You can store them as strings then when loading use UUID#fromString() method to restore them.
  7. Where in your code do you grab the targets uuid?

    Did you read the post before replying?
  8. Didn't see that last part. Only saw the title and first part, thanks.
    the _target and _player how are you working these out? Is target used by using Bukkit.getPlayer(argument in command)? That is the only error I can think of after viewing your code.