Player name -> UUID "Fetcher"

Discussion in 'Resources' started by evilmidget38, Mar 30, 2014.

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

    KingFaris11

    Yeah, I was testing with a fake player (YoloSwag69) and "".
     
  2. Offline

    EcMiner

    The result gives me a different UUID then when I do p.getUniqueId()... Any ideas?
     
  3. Offline

    Quackster

    The only time it will do that is if you changed your Bukkit properties to allow offline mode clients.
     
    evilmidget38 likes this.
  4. Offline

    EcMiner


    Thanks for the quick respond <3
     
  5. Offline

    Staartvin

    evilmidget38

    Hey, Evil, it might be good to change the link on the original post and put a little note so that everybody knows it was updated. I'm sure not a lot of people like to search through the comments to find the updated version ;)
     
  6. Offline

    evilmidget38 Retired Staff

    Staartvin Yeah, that's probably a good idea. I updated the link on the main post, but updating it is a good idea. I'll do that now.
     
    lukegb likes this.
  7. Offline

    EnderTroll68

    Any chance you could make this not case sensitive?
     
  8. Offline

    ZachBora

    Dang mojang makes your code erro' when it's down.

    Code:
    [21:02:50] [pool-3-thread-3/WARN]: java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.mojang.com/profiles/minecraft
    [21:02:50] [pool-3-thread-3/WARN]:at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    [21:02:50] [pool-3-thread-3/WARN]:at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    [21:02:50] [pool-3-thread-3/WARN]:at com.worldcretornica.plotme.utils.UUIDFetcher.call(UUIDFetcher.java:41)
    [21:02:50] [pool-3-thread-3/WARN]:at com.worldcretornica.plotme.SqlManager$2.run(SqlManager.java:1524)
    [21:02:50] [pool-3-thread-3/WARN]:at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftTask.run(CraftTask.java:53)
    [21:02:50] [pool-3-thread-3/WARN]:at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
    [21:02:50] [pool-3-thread-3/WARN]:at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    [21:02:50] [pool-3-thread-3/WARN]:at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    [21:02:50] [pool-3-thread-3/WARN]:at java.lang.Thread.run(Unknown Source)
    
    I just tested and it's case insensitive. I can send names with wrong capitals and it works.

    Edit: ohhh... I see what you mean. I checked and what it saved doesn't work. But I don't think he can fix that.

    Edit2: I just tested and yes its case insensitive. Mojang will return the correct spelling too.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  9. Offline

    KingFaris11

    Getting:
    Using NameFetcher from like 1 week ago - code for using it:
    Code:
    NameFetcher nameFetcher = new NameFetcher(uuidList);[/S]
    Map<UUID, String> nameFetcherResults = nameFetcher.call();[/S]
    for (Entry<UUID, String> uuidEntry : nameFetcherResults.entrySet())[/S]
        this.playerUUIDs.put(uuidEntry.getValue(), uuidEntry.getKey());[/S]
    
    Edit: Nvm - Fixed it by re-downloading the code from NameFetcher.
     
  10. Offline

    CrystalxNeth

  11. Offline

    Yive


    I'm adding in support for UUIDs containing - in them.

    I am currently working on a branch of my UUID/Name conversion pages so that they can send more than 1 name per request. Currently I just need to figure out how I could do such a thing in PHP.
     
  12. Offline

    ZachBora


    I would assume it not to be hard. You just need to create a request that contains a json array. I don't know how that is done though.

    A POST request with the content-type "application/json" and it would contain for example :
    ["zaChbora","zaCHBORACAM"]

    You'll get back this :
    [{"id":"df294fb537714fec9ebc66afe2d90743","name":"ZachBoraCam"},{"id":"d8af11a5c3364736b628973dc7ec271b","name":"ZachBora"}]
     
  13. Offline

    Yive

    Got it working with some help from turt2live.

    This was a 100 person test which had no delay at all.
    http://pastebin.com/Cr4izXNW

    Not 100% sure if that format is easy for devs though since I can't test in Java since I don't understand that language.
     
  14. Offline

    ZachBora

    Yive There's a library for json org.json.simple

    Edit: I'm wondering what the use of a list of uuids was though?
     
  15. Offline

    Yive

    Apparently people need to send more than one username for converting their database or something. Not 100% sure.
    KingFaris11 is making something which needs to send more than 1 player name in a request, most likely to convert names to uuids or something.
     
  16. Offline

    ZachBora

    Yive what i meant is that if you send multiple uuid, you need to also include the username ;)
     
  17. Offline

    Yive

    Ah, my misunderstanding. I just added that in, I also plan on allowing the API to accept POST requests.
     
  18. Offline

    StaticJava

    Is the Gson version of the code still available? evilmidget38
     
  19. Offline

    evilmidget38 Retired Staff

    StaticJava likes this.
  20. Offline

    StaticJava

  21. Offline

    minoneer

    evilmidget38 Great Code!

    I have one question though: the MAX_SEARCH value in your UUID-Fetcher is set to 100. Is this a mojang restriction, or could I change it to be around 5000?

    Edit: never mind, I was using an old version
     
  22. Offline

    Sgt_Tailor

    I made a small program that will rename playerfiles. This might come in handy for renaming all those playerfiles :p. You can choose the filter (first argument) and if you want the filter to be replaced by just .yml. I thought this would be better than renaming 20k userfiles myself.

    https://gist.github.com/SvenWiltink/30ff7945fed4b7898be6
     
    KingFaris11 likes this.
  23. Offline

    Brettflan

    I noticed the same problem, specifically for looking up a single UUID on a name where the case returned isn't the same as what was sent, resulting in a null value being returned by the getUUIDOf() method. For my own purposes to work around it, since I only need to look up a single name at a time, I standardized it to lowercase. I modified this:
    Code:java
    1. uuidMap.put(name, uuid);
    to:
    Code:java
    1. uuidMap.put(name.toLowerCase(), uuid);
    And this:
    Code:java
    1. return new UUIDFetcher(Arrays.asList(name)).call().get(name);
    to:
    Code:java
    1. return new UUIDFetcher(Arrays.asList(name)).call().get(name.toLowerCase());

    That might pose a minor problem when reading out a list rather than just using getUUIDOf(). You'd need to make sure to use lowercase for the key name when using get(name) on the array, like so (based on example code in the first post):
    Code:java
    1. UUID uuid = response.get(playerName.toLowerCase());

    If just using UUIDFetcher.getUUIDOf(String name), you don't need to worry about case after the above changes.
     
  24. Offline

    Staartvin

  25. Offline

    DevRosemberg

    evilmidget38 how would you get the Name of a player using Namefetcher?
     
    MBon29 likes this.
  26. Offline

    MBon29

    I need help with this too. Does anyone have an example? Something like getting one name would help me understand.
     
  27. Offline

    Phasesaber

    Hrm, doesn't seem to be working. :\
    I am getting a String from user input (command), and doing:
    Code:java
    1. UUID u = null;
    2. try {
    3. u = UUIDFetcher.getUUIDOf(args[1]);
    4. } catch (Exception e) {
    5. // TODO Auto-generated catch block
    6. e.printStackTrace();
    7. }

    And When I check to see if it's null
    Code:
    if(u == null){
    It triggers, so it doesn't seem to be getting it.
    Am I using it wrong?

    The NameFetcher seems to be working fine for me.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  28. Offline

    Funergy

Thread Status:
Not open for further replies.

Share This Page