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 String func_71755_c() throws IOException { if(this.field_71757_g == null) { int var1 = -1; try { var1 = HttpUtil.func_76181_a(); } catch (IOException var4) { ; } if(var1 <= 0) { var1 = 25564; } try { this.field_71757_g = new ServerListenThread(this, (InetAddress)null, var1); this.field_71757_g.start(); } catch (IOException var3) { throw var3; } } return String.valueOf(this.field_71757_g.func_71765_d()); }
public static void updateColorAsync(final World worldIn, final BlockPos glassPos) { HttpUtil.field_180193_a.submit(new Runnable() { public void run() { Chunk chunk = worldIn.getChunkFromBlockCoords(glassPos); for (int i = glassPos.getY() - 1; i >= 0; --i) { final BlockPos blockpos = new BlockPos(glassPos.getX(), i, glassPos.getZ()); if (!chunk.canSeeSky(blockpos)) { break; } IBlockState iblockstate = worldIn.getBlockState(blockpos); if (iblockstate.getBlock() == Blocks.beacon) { ((WorldServer)worldIn).addScheduledTask(new Runnable() { public void run() { TileEntity tileentity = worldIn.getTileEntity(blockpos); if (tileentity instanceof TileEntityBeacon) { ((TileEntityBeacon)tileentity).updateBeacon(); worldIn.addBlockEvent(blockpos, Blocks.beacon, 1, 0); } } }); } } } }); }
/** * Note issuing start multiple times is not an error. */ public void startSnooper() { if (!this.isRunning) { this.isRunning = true; this.func_152766_h(); this.threadTrigger.schedule(new TimerTask() { public void run() { if (PlayerUsageSnooper.this.playerStatsCollector.isSnooperEnabled()) { Map<String, Object> map; synchronized (PlayerUsageSnooper.this.syncLock) { map = Maps.<String, Object>newHashMap(PlayerUsageSnooper.this.field_152774_b); if (PlayerUsageSnooper.this.selfCounter == 0) { map.putAll(PlayerUsageSnooper.this.field_152773_a); } map.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.this.selfCounter++)); map.put("snooper_token", PlayerUsageSnooper.this.uniqueID); } HttpUtil.postMap(PlayerUsageSnooper.this.serverUrl, map, true); } } }, 0L, 900000L); } }
/** * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. */ public String shareToLAN(WorldSettings.GameType type, boolean allowCheats) { try { int i = -1; try { i = HttpUtil.getSuitableLanPort(); } catch (IOException var5) { ; } if (i <= 0) { i = 25564; } this.getNetworkSystem().addLanEndpoint((InetAddress)null, i); logger.info("Started on " + i); this.isPublic = true; this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), i + ""); this.lanServerPing.start(); this.getConfigurationManager().setGameType(type); this.getConfigurationManager().setCommandsAllowedForAll(allowCheats); return i + ""; } catch (IOException var6) { return null; } }
public static void updateColorAsync(final World worldIn, final BlockPos glassPos) { HttpUtil.DOWNLOADER_EXECUTOR.submit(new Runnable() { public void run() { Chunk chunk = worldIn.getChunkFromBlockCoords(glassPos); for (int i = glassPos.getY() - 1; i >= 0; --i) { final BlockPos blockpos = new BlockPos(glassPos.getX(), i, glassPos.getZ()); if (!chunk.canSeeSky(blockpos)) { break; } IBlockState iblockstate = worldIn.getBlockState(blockpos); if (iblockstate.getBlock() == Blocks.BEACON) { ((WorldServer)worldIn).addScheduledTask(new Runnable() { public void run() { TileEntity tileentity = worldIn.getTileEntity(blockpos); if (tileentity instanceof TileEntityBeacon) { ((TileEntityBeacon)tileentity).updateBeacon(); worldIn.addBlockEvent(blockpos, Blocks.BEACON, 1, 0); } } }); } } } }); }
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(); } }
/** * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. */ public String shareToLAN(GameType type, boolean allowCheats) { try { int i = -1; try { i = HttpUtil.getSuitableLanPort(); } catch (IOException var5) { ; } if (i <= 0) { i = 25564; } this.getNetworkSystem().addLanEndpoint((InetAddress)null, i); LOGGER.info("Started on {}", new Object[] {Integer.valueOf(i)}); this.isPublic = true; this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), i + ""); this.lanServerPing.start(); this.getPlayerList().setGameType(type); this.getPlayerList().setCommandsAllowedForAll(allowCheats); this.mc.player.setPermissionLevel(allowCheats ? 4 : 0); return i + ""; } catch (IOException var6) { return null; } }
/** * Note issuing start multiple times is not an error. */ public void startSnooper() { if (!this.isRunning) { this.isRunning = true; this.addOSData(); this.threadTrigger.schedule(new TimerTask() { public void run() { if (Snooper.this.playerStatsCollector.isSnooperEnabled()) { Map<String, Object> map; synchronized (Snooper.this.syncLock) { map = Maps.<String, Object>newHashMap(Snooper.this.clientStats); if (Snooper.this.selfCounter == 0) { map.putAll(Snooper.this.snooperStats); } map.put("snooper_count", Integer.valueOf(Snooper.this.selfCounter++)); map.put("snooper_token", Snooper.this.uniqueID); } MinecraftServer minecraftserver = Snooper.this.playerStatsCollector instanceof MinecraftServer ? (MinecraftServer)Snooper.this.playerStatsCollector : null; HttpUtil.postMap(Snooper.this.serverUrl, map, true, minecraftserver == null ? null : minecraftserver.getServerProxy()); } } }, 0L, 900000L); } }
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(); } }
/** * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. */ public String shareToLAN(GameType type, boolean allowCheats) { try { int i = -1; try { i = HttpUtil.getSuitableLanPort(); } catch (IOException var5) { ; } if (i <= 0) { i = 25564; } this.getNetworkSystem().addLanEndpoint((InetAddress)null, i); LOGGER.info("Started on {}", new Object[] {Integer.valueOf(i)}); this.isPublic = true; this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), i + ""); this.lanServerPing.start(); this.getPlayerList().setGameType(type); this.getPlayerList().setCommandsAllowedForAll(allowCheats); this.mc.thePlayer.setPermissionLevel(allowCheats ? 4 : 0); return i + ""; } catch (IOException var6) { return null; } }
/** * Note issuing start multiple times is not an error. */ public void startSnooper() { if (!this.isRunning) { this.isRunning = true; this.func_152766_h(); this.threadTrigger.schedule(new TimerTask() { private static final String __OBFID = "CL_00001516"; public void run() { if (PlayerUsageSnooper.this.playerStatsCollector.isSnooperEnabled()) { HashMap hashmap; synchronized (PlayerUsageSnooper.this.syncLock) { hashmap = new HashMap(PlayerUsageSnooper.this.field_152774_b); if (PlayerUsageSnooper.this.selfCounter == 0) { hashmap.putAll(PlayerUsageSnooper.this.field_152773_a); } hashmap.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.access$308(PlayerUsageSnooper.this))); hashmap.put("snooper_token", PlayerUsageSnooper.this.uniqueID); } HttpUtil.func_151226_a(PlayerUsageSnooper.this.serverUrl, hashmap, true); } } }, 0L, 900000L); } }
/** * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. */ public String shareToLAN(WorldSettings.GameType par1EnumGameType, boolean par2) { try { int var6 = -1; try { var6 = HttpUtil.func_76181_a(); } catch (IOException var5) { ; } if (var6 <= 0) { var6 = 25564; } this.func_147137_ag().addLanEndpoint((InetAddress)null, var6); logger.info("Started on " + var6); this.isPublic = true; this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), var6 + ""); this.lanServerPing.start(); this.getConfigurationManager().setGameType(par1EnumGameType); this.getConfigurationManager().setCommandsAllowedForAll(par2); return var6 + ""; } catch (IOException var61) { return null; } }
/** * Note issuing start multiple times is not an error. */ public void startSnooper() { if (!this.isRunning) { this.isRunning = true; this.addBaseDataToSnooper(); this.threadTrigger.schedule(new TimerTask() { private static final String __OBFID = "CL_00001516"; public void run() { if (PlayerUsageSnooper.this.playerStatsCollector.isSnooperEnabled()) { HashMap var1; synchronized (PlayerUsageSnooper.this.syncLock) { var1 = new HashMap(PlayerUsageSnooper.this.dataMap); var1.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.getSelfCounterFor(PlayerUsageSnooper.this))); } HttpUtil.func_151226_a(PlayerUsageSnooper.this.serverUrl, var1, true); } } }, 0L, 900000L); } }
public String shareToLAN(WorldSettings.GameType p_71206_1_, boolean p_71206_2_) { try { int i = -1; try { i = HttpUtil.func_76181_a(); } catch (IOException ioexception) { ; } if (i <= 0) { i = 25564; } this.func_147137_ag().addLanEndpoint((InetAddress)null, i); logger.info("Started on " + i); this.isPublic = true; this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), i + ""); this.lanServerPing.start(); this.getConfigurationManager().func_152604_a(p_71206_1_); this.getConfigurationManager().setCommandsAllowedForAll(p_71206_2_); return i + ""; } catch (IOException ioexception1) { return null; } }
public void startSnooper() { if (!this.isRunning) { this.isRunning = true; this.func_152766_h(); this.threadTrigger.schedule(new TimerTask() { private static final String __OBFID = "CL_00001516"; public void run() { if (PlayerUsageSnooper.this.playerStatsCollector.isSnooperEnabled()) { HashMap hashmap; synchronized (PlayerUsageSnooper.this.syncLock) { hashmap = new HashMap(PlayerUsageSnooper.this.field_152774_b); if (PlayerUsageSnooper.this.selfCounter == 0) { hashmap.putAll(PlayerUsageSnooper.this.field_152773_a); } hashmap.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.access$308(PlayerUsageSnooper.this))); hashmap.put("snooper_token", PlayerUsageSnooper.this.uniqueID); } HttpUtil.func_151226_a(PlayerUsageSnooper.this.serverUrl, hashmap, true); } } }, 0L, 900000L); } }
public void run() { if(PlayerUsageSnooper.func_76473_a(this.field_76344_a).func_70002_Q()) { HashMap var1; synchronized(PlayerUsageSnooper.func_76474_b(this.field_76344_a)) { var1 = new HashMap(PlayerUsageSnooper.func_76469_c(this.field_76344_a)); var1.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.func_76466_d(this.field_76344_a))); } HttpUtil.func_76183_a(PlayerUsageSnooper.func_76473_a(this.field_76344_a).func_98033_al(), PlayerUsageSnooper.func_76475_e(this.field_76344_a), var1, true); } }
public String func_71755_c() throws IOException { if (this.myServerListenThread == null) { int i = -1; try { i = HttpUtil.func_76181_a(); } catch (IOException ioexception) { ; } if (i <= 0) { i = 25564; } try { this.myServerListenThread = new ServerListenThread(this, (InetAddress)null, i); this.myServerListenThread.start(); } catch (IOException ioexception1) { throw ioexception1; } } return String.valueOf(this.myServerListenThread.getMyPort()); }
public void run() { if (PlayerUsageSnooper.getStatsCollectorFor(this.snooper).isSnooperEnabled()) { HashMap hashmap; synchronized (PlayerUsageSnooper.getSyncLockFor(this.snooper)) { hashmap = new HashMap(PlayerUsageSnooper.getDataMapFor(this.snooper)); hashmap.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.getSelfCounterFor(this.snooper))); } HttpUtil.sendPost(PlayerUsageSnooper.getStatsCollectorFor(this.snooper).getLogAgent(), PlayerUsageSnooper.getServerUrlFor(this.snooper), hashmap, true); } }
public TwitchStream(Minecraft mcIn, final Property streamProperty) { this.mc = mcIn; this.broadcastController = new BroadcastController(); this.chatController = new ChatController(); this.broadcastController.func_152841_a(this); this.chatController.func_152990_a(this); this.broadcastController.func_152842_a("nmt37qblda36pvonovdkbopzfzw3wlq"); this.chatController.func_152984_a("nmt37qblda36pvonovdkbopzfzw3wlq"); this.twitchComponent.getChatStyle().setColor(EnumChatFormatting.DARK_PURPLE); if (streamProperty != null && !Strings.isNullOrEmpty(streamProperty.getValue()) && OpenGlHelper.framebufferSupported) { Thread thread = new Thread("Twitch authenticator") { public void run() { try { URL url = new URL("https://api.twitch.tv/kraken?oauth_token=" + URLEncoder.encode(streamProperty.getValue(), "UTF-8")); String s = HttpUtil.get(url); JsonObject jsonobject = JsonUtils.getJsonObject((new JsonParser()).parse(s), "Response"); JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "token"); if (JsonUtils.getBoolean(jsonobject1, "valid")) { String s1 = JsonUtils.getString(jsonobject1, "user_name"); TwitchStream.LOGGER.debug(TwitchStream.STREAM_MARKER, "Authenticated with twitch; username is {}", new Object[] {s1}); AuthToken authtoken = new AuthToken(); authtoken.data = streamProperty.getValue(); TwitchStream.this.broadcastController.func_152818_a(s1, authtoken); TwitchStream.this.chatController.func_152998_c(s1); TwitchStream.this.chatController.func_152994_a(authtoken); Runtime.getRuntime().addShutdownHook(new Thread("Twitch shutdown hook") { public void run() { TwitchStream.this.shutdownStream(); } }); TwitchStream.this.broadcastController.func_152817_A(); TwitchStream.this.chatController.func_175984_n(); } else { TwitchStream.this.authFailureReason = IStream.AuthFailureReason.INVALID_TOKEN; TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, "Given twitch access token is invalid"); } } catch (IOException ioexception) { TwitchStream.this.authFailureReason = IStream.AuthFailureReason.ERROR; TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, (String)"Could not authenticate with twitch", (Throwable)ioexception); } } }; thread.setDaemon(true); thread.start(); } }
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(); } }