Discussion in 'Resources' started by KingFaris11, Apr 13, 2014.

Thread Status:
Not open for further replies.
  1. Hello, this is a simple API for the UUID system.

    API: http://bit.ly/UUIDApi
    Credit goes to Yive for making MineSkin and the website API, and DenialMC for making the core getUUIDsAsString() method for me.
    Temporary credit goes to: CraftThatBlock for the getName() method - but this will be changed to be using MineSkin once Yive has updated it.

    Example use:
    public class Main extends JavaPlugin {
        public void onEnable() {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equals("kills")) {
                if (args.length == 1) {
                    String strTargetName = args[0];
                    String targetUUID = UUIDApi.getUUIDAsString(strTargetName);
                    if (targetUUID != null) {
                        int playerKills = this.getConfig().contains(targetUUID) ? this.getConfig().getInt(targetUUID) : 0;
                        sender.sendMessage(ChatColor.GOLD + "Kills: " + playerKills);
                    } else {
                        sender.sendMessage(ChatColor.RED + "That player does not exist.");
                } else {
                    sender.sendMessage(ChatColor.GOLD + "UUIDApi v1.0.1 example");
                return true;
            return false;
    Phasesaber likes this.
  2. Offline


    Your example will freeze the server's main thread until UUIDFetcher is done fetching the data from mojang.
  3. How-so? I mean, if it's fetching the data, it would only take a while to send the message "Kills:", other things won't matter, would they? Also, to fix this, would I have to create a new Thread?

    I'll do some testing, thanks for the notice though.

    Okay, so I did some testing blablubbabc and when the server starts, I made it fetch UUID from my username and a few others, and it did pause for 3 seconds.
    However, when I joined and typed /kills KingFaris10 - I could still do everything and type commands but the messages from the commands (and /kills) didn't show up until it was loaded.

    I'm getting this error every second time I type the command:
    That's strange. I reloaded the server and the error's gone... But if I reload again a few times or so it comes back, seems like the plugin can't fetch data at some times.

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


    This however will freeze as well if the server has to lookup the uuid via the mojang lookup service. Though I think it caches the result of that lookup then for about 1 month on the server, so requests for the same name go faster afterwards..

    Also I am not sure if this method works on both, offline and online mode servers, equally well because I am not sure if it will return the offline mode uuid for a player on an offline mode server or looks up an online mode uuid for the given name..

    And on online mode servers it might return wrong results as well, for example if the mojang services are temporary not reach-able: it might then return an offline mode uuid instead, which, on an online mode server, is useless for persistent storage or lookup at that moment..
  5. It works for both, but I won't be using this method until Bukkit have improved their system for it as they said they would in future versions.
  6. Offline


    On line 12 you could have used "int playerKills = this.getConfig.getInt(targetUUID,0);"

    Bukkit's API for configurations include returning default values if it can't find what you are looking for.
    KingFaris11 likes this.
  7. I knew about that, just wanted to make people know about the ? and : feature. :p
  8. Offline


    I'm using this API for a plugin I'm making now, slightly modified to DRY (don't repeat yourself). But I'm getting an error.
    [14:53:07 WARN]: Unexpected token END OF FILE at position 0.
    [14:53:07 WARN]:        at org.json.simple.parser.JSONParser.parse(Unknown Sourc
    [14:53:07 WARN]:        at org.json.simple.parser.JSONParser.parse(Unknown Sourc
    The plugin does work fine, I'm just getting this error in the console :C
  9. I think it's getting an error at the end of Mojang's page... hmmm...
  10. Updated to v1.0.1!
    All bugs have been fixed and it now uses MineSkin's API thanks to Yive! It has almost 100% uptime compared to Mojang's UUID API server.

    Note: getName() coming soon!
  11. Offline


    For the record, the default default value is 0, so you don't even need to provide it there. :p
    KingFaris11 likes this.
  12. Offline


    I know this is completely off topic from this thread but I love your KingKits plugin, when I had zero java experience I always used your plugin since I owned a kitPvP server with 20-40 active players, amazing plugin xD
    KingFaris11 likes this.
  13. Offline


    Sick, although for me the getName() isn't working.
  14. Yeah, I realised that, getName() wasn't coded by me but was taken from an open source (SwordPvP). I'll try working something out with it, the problem is, Yive's API only allows single UUIDs for now, and not multiple (as a list).
  15. Offline


    This does rely on Mojang's servers because the API you are using relies on it. Sorry to burst your bubble.
  16. Offline


    this thread misleading and trollish.

    relying on API that rely on Mojang is still relying on Mojang
    Chiller, TfT_02, evilmidget38 and 2 others like this.
  17. "bubble"

    It was misleading, but not "trollish".

    Anyway, I realised that almost as soon as I posted the latest version, this project/class is just abandoned therefore I didn't change the title/desc.
Thread Status:
Not open for further replies.

Share This Page