private void func_148528_a(String p_148528_1_, File p_148528_2_) { HashMap var3 = Maps.newHashMap(); GuiScreenWorking var4 = new GuiScreenWorking(); var3.put("X-Minecraft-Username", Minecraft.getMinecraft().getSession().getUsername()); var3.put("X-Minecraft-UUID", Minecraft.getMinecraft().getSession().getPlayerID()); var3.put("X-Minecraft-Version", "1.7.2"); this.field_148533_g = true; Minecraft.getMinecraft().displayGuiScreen(var4); HttpUtil.func_151223_a(p_148528_2_, p_148528_1_, new HttpUtil.DownloadListener() { private static final String __OBFID = "CL_00001089"; public void func_148522_a(File p_148522_1_) { if (ResourcePackRepository.this.field_148533_g) { ResourcePackRepository.this.field_148533_g = false; ResourcePackRepository.this.field_148532_f = new FileResourcePack(p_148522_1_); Minecraft.getMinecraft().scheduleResourcesRefresh(); } } }, var3, 52428800, var4, Minecraft.getMinecraft().getProxy()); }
private void func_148528_a(String p_148528_1_, File p_148528_2_) { HashMap hashmap = Maps.newHashMap(); GuiScreenWorking guiscreenworking = new GuiScreenWorking(); hashmap.put("X-Minecraft-Username", Minecraft.getMinecraft().getSession().getUsername()); hashmap.put("X-Minecraft-UUID", Minecraft.getMinecraft().getSession().getPlayerID()); hashmap.put("X-Minecraft-Version", "1.7.10"); this.field_148533_g = true; Minecraft.getMinecraft().displayGuiScreen(guiscreenworking); HttpUtil.func_151223_a(p_148528_2_, p_148528_1_, new HttpUtil.DownloadListener() { private static final String __OBFID = "CL_00001089"; public void func_148522_a(File p_148522_1_) { if (ResourcePackRepository.this.field_148533_g) { ResourcePackRepository.this.field_148533_g = false; ResourcePackRepository.this.field_148532_f = new FileResourcePack(p_148522_1_); Minecraft.getMinecraft().scheduleResourcesRefresh(); } } }, hashmap, 52428800, guiscreenworking, Minecraft.getMinecraft().getProxy()); }
public ListenableFuture<Object> downloadResourcePack(String url, String hash) { String s = DigestUtils.sha1Hex(url); final String s1 = SHA1.matcher(hash).matches() ? hash : ""; final File file1 = new File(this.dirServerResourcepacks, s); this.lock.lock(); try { this.clearResourcePack(); if (file1.exists()) { if (this.checkHash(s1, file1)) { ListenableFuture listenablefuture2 = this.setResourcePackInstance(file1); ListenableFuture listenablefuture3 = listenablefuture2; return listenablefuture3; } LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } this.deleteOldServerResourcesPacks(); final GuiScreenWorking guiscreenworking = new GuiScreenWorking(); Map<String, String> map = getDownloadHeaders(); final Minecraft minecraft = Minecraft.getMinecraft(); Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() { public void run() { minecraft.displayGuiScreen(guiscreenworking); } })); final SettableFuture<Object> settablefuture = SettableFuture.<Object>create(); this.downloadingPacks = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy()); Futures.addCallback(this.downloadingPacks, new FutureCallback<Object>() { public void onSuccess(@Nullable Object p_onSuccess_1_) { if (ResourcePackRepository.this.checkHash(s1, file1)) { ResourcePackRepository.this.setResourcePackInstance(file1); settablefuture.set((Object)null); } else { ResourcePackRepository.LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } } public void onFailure(Throwable p_onFailure_1_) { FileUtils.deleteQuietly(file1); settablefuture.setException(p_onFailure_1_); } }); ListenableFuture listenablefuture = this.downloadingPacks; ListenableFuture listenablefuture11 = listenablefuture; return listenablefuture11; } finally { this.lock.unlock(); } }
public ListenableFuture<Object> downloadResourcePack(String url, String hash) { String s = DigestUtils.sha1Hex(url); final String s1 = SHA1.matcher(hash).matches() ? hash : ""; final File file1 = new File(this.dirServerResourcepacks, s); this.lock.lock(); try { this.clearResourcePack(); if (file1.exists()) { if (this.checkHash(s1, file1)) { ListenableFuture listenablefuture1 = this.setResourcePackInstance(file1); return listenablefuture1; } LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } this.deleteOldServerResourcesPacks(); final GuiScreenWorking guiscreenworking = new GuiScreenWorking(); Map<String, String> map = getDownloadHeaders(); final Minecraft minecraft = Minecraft.getMinecraft(); Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() { public void run() { minecraft.displayGuiScreen(guiscreenworking); } })); final SettableFuture<Object> settablefuture = SettableFuture.<Object>create(); this.downloadingPacks = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy()); Futures.addCallback(this.downloadingPacks, new FutureCallback<Object>() { public void onSuccess(@Nullable Object p_onSuccess_1_) { if (ResourcePackRepository.this.checkHash(s1, file1)) { ResourcePackRepository.this.setResourcePackInstance(file1); settablefuture.set((Object)null); } else { ResourcePackRepository.LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } } public void onFailure(Throwable p_onFailure_1_) { FileUtils.deleteQuietly(file1); settablefuture.setException(p_onFailure_1_); } }); ListenableFuture listenablefuture = this.downloadingPacks; return listenablefuture; } finally { this.lock.unlock(); } }
public ListenableFuture<Object> downloadResourcePack(String url, String hash) { String s; if (hash.matches("^[a-f0-9]{40}$")) { s = hash; } else { s = "legacy"; } final File file1 = new File(this.dirServerResourcepacks, s); this.lock.lock(); try { this.func_148529_f(); if (file1.exists() && hash.length() == 40) { try { String s1 = Hashing.sha1().hashBytes(Files.toByteArray(file1)).toString(); if (s1.equals(hash)) { ListenableFuture listenablefuture1 = this.setResourcePackInstance(file1); return listenablefuture1; } logger.warn("File " + file1 + " had wrong hash (expected " + hash + ", found " + s1 + "). Deleting it."); FileUtils.deleteQuietly(file1); } catch (IOException ioexception) { logger.warn((String)("File " + file1 + " couldn\'t be hashed. Deleting it."), (Throwable)ioexception); FileUtils.deleteQuietly(file1); } } this.func_183028_i(); final GuiScreenWorking guiscreenworking = new GuiScreenWorking(); Map<String, String> map = Minecraft.getSessionInfo(); final Minecraft minecraft = Minecraft.getMinecraft(); Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() { public void run() { minecraft.displayGuiScreen(guiscreenworking); } })); final SettableFuture<Object> settablefuture = SettableFuture.<Object>create(); this.field_177322_i = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy()); Futures.addCallback(this.field_177322_i, new FutureCallback<Object>() { public void onSuccess(Object p_onSuccess_1_) { ResourcePackRepository.this.setResourcePackInstance(file1); settablefuture.set((Object)null); } public void onFailure(Throwable p_onFailure_1_) { settablefuture.setException(p_onFailure_1_); } }); ListenableFuture listenablefuture = this.field_177322_i; return listenablefuture; } finally { this.lock.unlock(); } }
public ListenableFuture<Object> downloadResourcePack(String url, String hash) { String s = DigestUtils.sha1Hex(url); final String s1 = field_190117_e.matcher(hash).matches() ? hash : ""; final File file1 = new File(this.dirServerResourcepacks, s); this.lock.lock(); try { this.clearResourcePack(); if (file1.exists()) { if (this.func_190113_a(s1, file1)) { ListenableFuture listenablefuture1 = this.setResourcePackInstance(file1); return listenablefuture1; } LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } this.deleteOldServerResourcesPacks(); final GuiScreenWorking guiscreenworking = new GuiScreenWorking(); Map<String, String> map = func_190115_a(); final Minecraft minecraft = Minecraft.getMinecraft(); Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() { public void run() { minecraft.displayGuiScreen(guiscreenworking); } })); final SettableFuture<Object> settablefuture = SettableFuture.<Object>create(); this.downloadingPacks = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy()); Futures.addCallback(this.downloadingPacks, new FutureCallback<Object>() { public void onSuccess(@Nullable Object p_onSuccess_1_) { if (ResourcePackRepository.this.func_190113_a(s1, file1)) { ResourcePackRepository.this.setResourcePackInstance(file1); settablefuture.set((Object)null); } else { ResourcePackRepository.LOGGER.warn("Deleting file {}", new Object[] {file1}); FileUtils.deleteQuietly(file1); } } public void onFailure(Throwable p_onFailure_1_) { FileUtils.deleteQuietly(file1); settablefuture.setException(p_onFailure_1_); } }); ListenableFuture listenablefuture = this.downloadingPacks; return listenablefuture; } finally { this.lock.unlock(); } }