Remove remaining old packages

This commit is contained in:
johni0702
2016-09-03 13:10:58 +02:00
parent 4de933516e
commit dca1131d49
40 changed files with 23 additions and 3206 deletions

View File

@@ -6,11 +6,10 @@ import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.replaymod.core.ReplayMod;
import com.replaymod.online.AuthenticationHash;
import com.replaymod.online.api.replay.ReplayModApiMethods;
import com.replaymod.online.api.replay.SearchQuery;
import com.replaymod.online.api.replay.holders.*;
import eu.crushedpixel.replaymod.gui.elements.listeners.ProgressUpdateListener;
import com.replaymod.online.AuthenticationHash;
import net.minecraft.client.Minecraft;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -21,6 +20,7 @@ import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.function.Consumer;
public class ApiClient {
@@ -135,7 +135,7 @@ public class ApiClient {
private boolean cancelDownload = false;
public void downloadFile(int file, File target, ProgressUpdateListener listener) throws IOException, ApiException {
public void downloadFile(int file, File target, Consumer<Float> listener) throws IOException, ApiException {
cancelDownload = false;
QueryBuilder builder = new QueryBuilder(ReplayModApiMethods.download_file);
@@ -168,7 +168,7 @@ public class ApiClient {
fout.write(data, 0, count);
read += count;
listener.onProgressChanged((float)(read)/fileSize);
listener.accept((float) read / fileSize);
}
} finally {
bin.close();

View File

@@ -10,7 +10,6 @@ import de.johni0702.minecraft.gui.element.GuiTextField;
import de.johni0702.minecraft.gui.layout.CustomLayout;
import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.Utils;
import eu.crushedpixel.replaymod.gui.GuiConstants;
public class GuiLoginPrompt extends AbstractGuiScreen<GuiLoginPrompt> {

View File

@@ -10,12 +10,11 @@ import de.johni0702.minecraft.gui.element.GuiButton;
import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
import de.johni0702.minecraft.gui.layout.CustomLayout;
import eu.crushedpixel.replaymod.gui.elements.listeners.ProgressUpdateListener;
import java.io.File;
import java.io.IOException;
public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading> implements ProgressUpdateListener {
public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading> {
private final GuiScreen cancelScreen;
private final ApiClient apiClient;
@@ -52,7 +51,7 @@ public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading
public void run() {
final File replayFile = mod.getDownloadedFile(replayId);
try {
apiClient.downloadFile(replayId, replayFile, GuiReplayDownloading.this);
apiClient.downloadFile(replayId, replayFile, progressBar::setProgress);
if (replayFile.exists()) {
getMinecraft().addScheduledTask(new Runnable() {
@Override
@@ -72,17 +71,6 @@ public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading
}).start();
}
@Override
public void onProgressChanged(float progress) {
progressBar.setProgress(progress);
}
@Override
public void onProgressChanged(float progress, String progressString) {
onProgressChanged(progress);
}
@Override
protected GuiReplayDownloading getThis() {
return this;
}