Custom Getter (UUID)

Discussion in 'Spigot Plugin Development' started by LarexPvP, Apr 30, 2017.

  1. Hey guys i need help
    i want to return a uuid

    my code i have:
    Code (Text):
    public static UUID uuid;

        public void getUUID(Player p){
           
            uuid = p.getUniqueId();
           
            return;
           
        }
    pls help
     
  2. you didn't even return anything.... (return uuid; is what you want)
    Also, you want it to be a UUID, not void.

    EDIT: You don't have to take this suggestion(but it's for the better), but make sure to go over the basic java concepts to get this down.
     
  3. change void to UUID and return; with return uuid;
     
  4. There is absolutely no point to this. What is wrong with Player::getUniqueId ?
     
  5. should look up some java guides and basic fundamentals before starting spigot.

    the uuid field most likely does not have to be static. also, you specify a return type in the method, void does not return a value. you'd want to return a UUID object.

    Code (Java):

    public UUID get(Player p) {
         return p.getUniqueId();
    }
    but of course, Player#getUniqueId returns this already...