Fe - Economy

59k Downloads

UUID conversion failing

vk2gpz opened this issue ยท 0 comments

commented

getAccounts() in MongoDB should use find().skip().limit() to fetch documnets in chunks rather than trying to get all at onece. The code sometimes fails with access timeout.

    DBCollection collection = getDatabase().getCollection(ACCOUNTS_COLLECTION);
    int size = (int) collection.count();
    final int CHUNK = 1000;
    int chunks = size / CHUNK;

    List<Account> accounts = new ArrayList<Account>();

    for (int i = 0; i < chunks; i++) {
        DBCursor cursor = collection.find().skip(i*CHUNK).limit(CHUNK);
        for (DBObject aCursor : cursor) {
            BasicDBObject accountObject = (BasicDBObject) aCursor;

            Account account = new Account(plugin, accountObject.getString("name"), accountObject.getString("uuid"), this);

            account.setMoney(accountObject.getDouble("money"));

            accounts.add(account);
        }
        cursor.close();
    }

looks like the current code uses the old way to fetch UUID from mojang's server. Got the following error and failed the conversion:

[10:45:25] [Server thread/WARN]: java.io.IOException: Server returned HTTP resp\onse code: 400 for URL: https://api.mojang.com/profiles/minecraft
[10:45:25] [Server thread/WARN]: at sun.net.www.protocol.http.HttpURLCon\nection.getInputStream(Unknown Source)
[10:45:25] [Server thread/WARN]: at sun.net.www.protocol.https.HttpsURLC\onnectionImpl.getInputStream(Unknown Source)
[10:45:25] [Server thread/WARN]: at org.melonbrew.fe.UUIDFetcher.call(UU\IDFetcher.java:82)
[10:45:25] [Server thread/WARN]: at org.melonbrew.fe.database.Database.c\onvertToUUID(Database.java:116)
[10:45:25] [Server thread/WARN]: at org.melonbrew.fe.database.databases.\MongoDB.init(MongoDB.java:40)
[10:45:25] [Server thread/WARN]: at org.melonbrew.fe.Fe.setupDatabase(Fe.java:207)
[10:45:25] [Server thread/WARN]: at org.melonbrew.fe.Fe.onEnable(Fe.java:77)
[10:45:25] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPlugin.se\tEnabled(JavaPlugin.java:316)
[10:45:25] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoa\der.enablePlugin(JavaPluginLoader.java:329)
[10:45:25] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManage\r.enablePlugin(SimplePluginManager.java:405)
[10:45:25] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_7_R3.Craft\Server.loadPlugin(CraftServer.java:476)
[10:45:25] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_7_R3.Craft\Server.enablePlugins(CraftServer.java:394)
[10:45:25] [Server thread/WARN]: at net.minecraft.server.v1_7_R3.Dedicat\edServer.init(DedicatedServer.java:137)
[10:45:25] [Server thread/WARN]: at net.minecraft.server.v1_7_R3.Minecra\ftServer.run(MinecraftServer.java:458)
[10:45:25] [Server thread/WARN]: at net.minecraft.server.v1_7_R3.ThreadS\erverApplication.run(SourceFile:628)
[10:45:25] [Server thread/INFO]: [Fe] [Fe] UUID conversion failed, disabling Fe!
[10:45:25] [Server thread/INFO]: [Fe] Disabling Fe v0.8-SNAPSHOT-b${BUILD_NUMBE\R}