Search in sources :

Example 1 with DownloadJsonObjectCallable

use of riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelSearchResults method fetchPage.

protected void fetchPage(int pageIndex) {
    if (!downloadedPageList.contains(pageIndex)) {
        downloadedPageList.add(pageIndex);
    } else {
        return;
    }
    try {
        String searchUrl = SEARCH_URL;
        searchUrl += "?search=" + URLEncoder.encode(search, "UTF-8");
        searchUrl += "&maxFileVersion=" + String.valueOf(Skin.FILE_VERSION);
        searchUrl += "&pageIndex=" + String.valueOf(pageIndex);
        searchUrl += "&pageSize=" + String.valueOf(skinPanelResults.getIconCount());
        pageCompletion.submit(new DownloadJsonObjectCallable(searchUrl));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}
Also used : DownloadJsonObjectCallable(riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 2 with DownloadJsonObjectCallable

use of riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable in project Armourers-Workshop by RiskyKen.

the class PlushieAuth method checkBetaCode.

public static FutureTask<JsonObject> checkBetaCode(UUID uuid) {
    String searchUrl;
    try {
        searchUrl = BETA_CODE_CHECK_URL + "?code=" + URLEncoder.encode(uuid.toString(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        return null;
    }
    FutureTask<JsonObject> futureTask = new FutureTask<JsonObject>(new DownloadJsonObjectCallable(searchUrl));
    JSON_DOWNLOAD_EXECUTOR.execute(futureTask);
    return futureTask;
}
Also used : DownloadJsonObjectCallable(riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable) FutureTask(java.util.concurrent.FutureTask) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonObject(com.google.gson.JsonObject)

Example 3 with DownloadJsonObjectCallable

use of riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable in project Armourers-Workshop by RiskyKen.

the class GlobalSkinLibraryUtils method deleteSkin.

public static FutureTask<JsonObject> deleteSkin(Executor executor, int userId, String accessToken, int skinId) {
    Validate.notNull(executor);
    Validate.notNull(userId);
    Validate.notNull(accessToken);
    String searchUrl = USER_SKIN_DELETE_URL + "?userId=" + String.valueOf(userId) + "&accessToken=" + accessToken + "&skinId=" + String.valueOf(skinId);
    FutureTask<JsonObject> futureTask = new FutureTask<JsonObject>(new DownloadJsonObjectCallable(searchUrl));
    executor.execute(futureTask);
    return futureTask;
}
Also used : DownloadJsonObjectCallable(riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable) FutureTask(java.util.concurrent.FutureTask) JsonObject(com.google.gson.JsonObject)

Example 4 with DownloadJsonObjectCallable

use of riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable in project Armourers-Workshop by RiskyKen.

the class PlushieAuth method isPlayerInBeta.

public static FutureTask<JsonObject> isPlayerInBeta(UUID uuid) {
    String searchUrl;
    try {
        searchUrl = BETA_CHECK_URL + "?uuid=" + URLEncoder.encode(uuid.toString(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        return null;
    }
    FutureTask<JsonObject> futureTask = new FutureTask<JsonObject>(new DownloadJsonObjectCallable(searchUrl));
    JSON_DOWNLOAD_EXECUTOR.execute(futureTask);
    return futureTask;
}
Also used : DownloadJsonObjectCallable(riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable) FutureTask(java.util.concurrent.FutureTask) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonObject(com.google.gson.JsonObject)

Example 5 with DownloadJsonObjectCallable

use of riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelSkinInfo method setSkinLike.

private void setSkinLike(boolean like) {
    if (authenticateUser()) {
        PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
        GuiGlobalLibrary globalLibrary = (GuiGlobalLibrary) parent;
        int userId = plushieSession.getServerId();
        String accessToken = plushieSession.getAccessToken();
        int skinId = skinJson.get("id").getAsInt();
        String url = "https://plushie.moe/armourers_workshop/user-skin-action.php";
        url += "?userId=" + String.valueOf(userId);
        url += "&accessToken=" + accessToken;
        if (like) {
            url += "&action=like";
        } else {
            url += "&action=unlike";
        }
        url += "&skinId=" + String.valueOf(skinId);
        taskDoLiked = new FutureTask<JsonObject>(new DownloadJsonObjectCallable(url));
        ((GuiGlobalLibrary) parent).jsonDownloadExecutor.execute(taskDoLiked);
    }
}
Also used : DownloadJsonObjectCallable(riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable) PlushieSession(riskyken.armourersWorkshop.common.library.global.auth.PlushieSession) JsonObject(com.google.gson.JsonObject) GuiGlobalLibrary(riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary)

Aggregations

DownloadJsonObjectCallable (riskyken.armourersWorkshop.common.library.global.DownloadUtils.DownloadJsonObjectCallable)7 JsonObject (com.google.gson.JsonObject)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 FutureTask (java.util.concurrent.FutureTask)3 GuiGlobalLibrary (riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary)2 PlushieSession (riskyken.armourersWorkshop.common.library.global.auth.PlushieSession)2