public void run() { targetName = (Settings.getFindTargetName() == null) ? "gfx/kritter/dragonfly/dragonfly" : Settings.getFindTargetName(); BotUtils.sysMsg("Target " + targetName, Color.WHITE); window = BotUtils.gui().add(new StatusWindow(), 300, 200); ui.root.findchild(FlowerMenu.class); while (BotUtils.getItemAtHand() == null) { GameUI gui = HavenPanel.lui.root.findchild(GameUI.class); IMeter.Meter stam = gui.getmeter("stam", 0); // Check energy stop if it is lower than 1500 IMeter.Meter nrj = gui.getmeter("nrj", 0); if (nrj.a <= 30) { t.stop(); return; } else if (stam.a <= 30 && nrj.a >= 95) { BotUtils.drink(); } // if (!BotUtils.isMoving()) { Gob gob = BotUtils.findObjectByNames(BotUtils.player().rc, 1000, targetName); if (gob != null) { BotUtils.goToCoord(gob.rc, 200, true); BotUtils.doClick(gob, 3, 0); } // } if (gob.getres().name.contains("terobjs")) { sleep(800); } sleep(800); } window.destroy(); t.stop(); }
/** Initializes manager and all subsystems. */ private void initialize() { /* * Disable java's own logging facility (java.util.logging) to prevent third party libraries * to clutter the console output. All error in libraries should be handled and logged in * FreeNono itself. */ LogManager.getLogManager().reset(); // load settings from file loadSettings(settingsFile); if (!settings.getGameLocale().equals(Locale.ROOT)) { Locale.setDefault(settings.getGameLocale()); } createSplashscreen(); updateSplashscreen(Messages.getString("Splashscreen.Building"), false); // Get instance to allow time for connecting to NonoWeb in background if (settings.shouldActivateChat()) { NonoWebConnectionManager.getInstance(); } // instantiate GameEventHelper and add own gameAdapter eventHelper = new GameEventHelper(); eventHelper.addGameListener(gameAdapter); settings.setEventHelper(eventHelper); // instantiate audio provider for game sounds audioProvider = new AudioProvider(eventHelper, settings); // instantiate highscore manager HighscoreManager.getInstance(settings).setEventHelper(eventHelper); // set game event helper for statistics manager SimpleStatistics.getInstance().setEventHelper(eventHelper); preloadLibraries(); updateSplashscreen(Messages.getString("Splashscreen.Loading"), true); // instantiate collection provider for all nonogram sources instantiateProvider(); /* * Instantiate achievement manager AFTER collection provider are ready because they are * needed for class AchievementMeterCompleteness. */ AchievementManager.getInstance(eventHelper, nonogramProvider); updateSplashscreen(Messages.getString("Splashscreen.Starting"), false); // Setup chat handler for NonoWeb connection that has been created in // background if (settings.shouldActivateChat()) { setupChat(); } }
public Settings build() { Settings result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
protected TabView openUrlInTab( String url, long urlLoadStartTime, boolean setAsCurrentTab, boolean hasShownAppPicker) { setHiddenByUser(false); if (getActiveTabCount() == 0) { mBubbleDraggable.setVisibility(View.VISIBLE); collapseBubbleFlow(0); mBubbleFlowDraggable.setVisibility(View.GONE); // Only do this snap if ContentView is showing. No longer obliterates slide-in animation if (contentViewShowing()) { mBubbleDraggable.snapToBubbleView(); } else { Point bubbleRestingPoint = Settings.get().getBubbleRestingPoint(); int fromX = Settings.get().getBubbleStartingX(bubbleRestingPoint); mBubbleDraggable.slideOnScreen( fromX, bubbleRestingPoint.y, bubbleRestingPoint.x, bubbleRestingPoint.y, Constant.BUBBLE_SLIDE_ON_SCREEN_TIME); } } TabView result = mBubbleFlowDraggable.openUrlInTab( url, urlLoadStartTime, setAsCurrentTab, hasShownAppPicker); showBadge(getActiveTabCount() > 1 ? true : false); ++mBubblesLoaded; mOpenUrlInfos.add(new OpenUrlInfo(url, urlLoadStartTime)); return result; }
private boolean handleResolveInfo( ResolveInfo resolveInfo, String urlAsString, long urlLoadStartTime) { if (Settings.get().didRecentlyRedirectToApp(urlAsString)) { return false; } boolean isLinkBubble = resolveInfo.activityInfo != null && resolveInfo.activityInfo.packageName.equals(mAppPackageName); if (isLinkBubble == false && MainApplication.loadResolveInfoIntent(mContext, resolveInfo, urlAsString, -1)) { if (getActiveTabCount() == 0 && Prompt.isShowing() == false) { finish(); } String title = String.format( mContext.getString(R.string.link_loaded_with_app), resolveInfo.loadLabel(mContext.getPackageManager())); MainApplication.saveUrlInHistory(mContext, resolveInfo, urlAsString, title); Settings.get().addRedirectToApp(urlAsString); Settings.get() .trackLinkLoadTime( System.currentTimeMillis() - urlLoadStartTime, Settings.LinkLoadType.AppRedirectInstant, urlAsString); return true; } return false; }
public static DropType getDropTypeToGenerate(String objectType) { String baseKey = "workbench.dbexplorer.generate.drop"; String type = Settings.getInstance().getProperty(baseKey, DropType.cascaded.name()); if (objectType != null && !"default".equalsIgnoreCase(objectType)) { type = Settings.getInstance() .getProperty(baseKey + "." + DbSettings.getKeyValue(objectType), type); } // migrate from the old setting (true/false) if ("true".equalsIgnoreCase(type)) { return DropType.cascaded; } if ("false".equalsIgnoreCase(type)) { return DropType.none; } try { return DropType.valueOf(type); } catch (Exception ex) { return DropType.cascaded; } }
public DecompilerSettings getDecompilerSettings() { CommandLineOptions options = new CommandLineOptions(); JCommander jCommander = new JCommander(options); // TODO remove dependency on JCommander? String[] args = new String[Settings.values().length * 2]; int index = 0; for (TransformerSettings.Setting setting : Settings.values()) { args[index++] = "--" + setting.getParam(); args[index++] = String.valueOf(setting.isEnabled()); } jCommander.parse(args); DecompilerSettings settings = new DecompilerSettings(); settings.setFlattenSwitchBlocks(options.getFlattenSwitchBlocks()); settings.setForceExplicitImports(!options.getCollapseImports()); settings.setForceExplicitTypeArguments(options.getForceExplicitTypeArguments()); settings.setRetainRedundantCasts(options.getRetainRedundantCasts()); settings.setShowSyntheticMembers(options.getShowSyntheticMembers()); settings.setExcludeNestedTypes(options.getExcludeNestedTypes()); settings.setOutputDirectory(options.getOutputDirectory()); settings.setIncludeLineNumbersInBytecode(options.getIncludeLineNumbers()); settings.setRetainPointlessSwitches(options.getRetainPointlessSwitches()); settings.setUnicodeOutputEnabled(options.isUnicodeOutputEnabled()); settings.setMergeVariables(options.getMergeVariables()); settings.setShowDebugLineNumbers(options.getShowDebugLineNumbers()); settings.setSimplifyMemberReferences(options.getSimplifyMemberReferences()); settings.setDisableForEachTransforms(options.getDisableForEachTransforms()); settings.setTypeLoader(new InputTypeLoader()); if (options.isRawBytecode()) { settings.setLanguage(Languages.bytecode()); } else if (options.isBytecodeAst()) { settings.setLanguage( options.isUnoptimized() ? Languages.bytecodeAstUnoptimized() : Languages.bytecodeAst()); } return settings; }
protected RequestConfig configureRequest(RequestConfig.Builder rcb, Settings settings) throws HTTPException { // Configure the RequestConfig for (Prop key : settings.getKeys()) { Object value = settings.getParameter(key); boolean tf = (value instanceof Boolean ? (Boolean) value : false); if (key == Prop.ALLOW_CIRCULAR_REDIRECTS) { rcb.setCircularRedirectsAllowed(tf); } else if (key == Prop.HANDLE_REDIRECTS) { rcb.setRedirectsEnabled(tf); rcb.setRelativeRedirectsAllowed(tf); } else if (key == Prop.MAX_REDIRECTS) { rcb.setMaxRedirects((Integer) value); } else if (key == Prop.SO_TIMEOUT) { rcb.setSocketTimeout((Integer) value); } else if (key == Prop.CONN_TIMEOUT) { rcb.setConnectTimeout((Integer) value); } else if (key == Prop.CONN_REQ_TIMEOUT) { rcb.setConnectionRequestTimeout((Integer) value); } else if (key == Prop.MAX_THREADS) { connmgr.setMaxTotal((Integer) value); connmgr.setDefaultMaxPerRoute((Integer) value); } /* else ignore */ } RequestConfig cfg = rcb.build(); return cfg; }
/** {@inheritDoc} */ @Override public void dispatchResourceLoadEvent( long frame, int state, String url, String contentType, double progress, int errorCode) { final Settings settings = SettingsManager.settings(); if (settings == null) { throw new RuntimeException("Request made after browser closed. Ignoring..."); } synchronized (statusCode) { if (url.startsWith("http://") || url.startsWith("https://")) { if (state == LoadListenerClient.RESOURCE_STARTED) { resources.put(frame + url, System.currentTimeMillis()); } else if (state == LoadListenerClient.RESOURCE_FINISHED || state == LoadListenerClient.RESOURCE_FAILED) { String original = null; original = statusMonitor.originalFromRedirect(url); resources.remove(frame + url); if (original != null) { resources.remove(frame + original); } } } } if ((settings.logTrace()) && (url.startsWith("http://") || url.startsWith("https://"))) { trace("Rsrc", frame, state, url, contentType, progress, errorCode); } }
public AndroidApplicationModel(Settings settings) { super(PLATFORM, settings); this.settings = settings; this.installDirectory = RegistryHandler.getInstallDir(); this.tempPath = System.getProperty("java.io.tmpdir"); // this.defaultAndroidProjectPath = installDirectory + "/PhonegapSDK/Default/android"; this.defaultAndroidProjectPath = settings.getProjectPath(); this.tempAndroidProjectPath = tempPath + "/android"; this.tempBuildFile = new File(tempPath + "/android/" + "build.xml"); this.tempWwwPath = tempAndroidProjectPath + "/assets/www"; this.tempManifestPath = tempAndroidProjectPath + "/AndroidManifest.xml"; this.tempSrcPath = tempAndroidProjectPath + "/src/"; this.tempStringsPath = tempAndroidProjectPath + "/res/values/strings.xml"; this.tempDrawableFolder = tempAndroidProjectPath + "/res/drawable"; this.buildProperties = tempAndroidProjectPath + "/build.properties"; this.antListener = new AntListener(); this.fileHandler = new FileHandler(); this.cmdHelper = new CmdHelper(); cmdHelper.addListener(this); antHelper = new AntHelper(); antHelper.addBuildListener(antListener); current = new AntClassLoader(null, Path.systemClasspath); androidKeys = settings.getAndroidKeys(); }
public HTTPSession setConnectionTimeout(int timeout) { if (timeout <= 0) throw new IllegalArgumentException("setConnectionTImeout"); localsettings.setParameter(Prop.CONN_TIMEOUT, timeout); localsettings.setParameter(Prop.CONN_REQ_TIMEOUT, timeout); this.cachevalid = false; return this; }
@Override public void onCreate() { super.onCreate(); is_Service_Running = true; date = new Date(); /* //code for step down registerReceiver(mybroadcast, new IntentFilter(Intent.ACTION_SCREEN_ON)); registerReceiver(mybroadcast, new IntentFilter(Intent.ACTION_SCREEN_OFF)); //code for step down */ PowerManager mgr = (PowerManager) context.getSystemService(Context.POWER_SERVICE); wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock"); wakeLock.acquire(); Settings.loadSettings(context); String path = Environment.getExternalStorageDirectory() + "/BU-Stat-Collector/" + Settings.getOutputFileName(context); File file = new File(path); stop_request = false; if (!file.exists()) { new StatsFileManager(context).createNewFile(); } }
private static Settings settings(DateMapping mapDate, String namespace) { final Settings settings = new Settings(); settings.jsonLibrary = JsonLibrary.jackson2; settings.namespace = namespace; settings.mapDate = mapDate; return settings; }
private Settings buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { Settings result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; }
public void okClicked(View view) { Settings settings = new Settings(); EditText et = (EditText) findViewById(R.id.port); String portText = et.getText().toString(); int port = 0; try { port = Integer.valueOf(portText); if (port < 1 || port > 60000) { Dialogs.getOKOnlyAlert("Port must be between 1 and 60000", this).show(); return; } } catch (NumberFormatException e) { Dialogs.getOKOnlyAlert("Invalid Number Format", this).show(); return; } settings.port = port; et = (EditText) findViewById(R.id.ip_address); settings.ipAddress = et.getText().toString(); settings.commit(this); Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); }
public void testSpecialTribeSetting() { { Settings settings = Settings.builder().put("tribe.blocks.write", "false").build(); SettingsModule module = new SettingsModule(settings); assertInstanceBinding(module, Settings.class, (s) -> s == settings); } { Settings settings = Settings.builder().put("tribe.blocks.write", "BOOM").build(); try { new SettingsModule(settings); fail(); } catch (IllegalArgumentException ex) { assertEquals( "Failed to parse value [BOOM] cannot be parsed to boolean [ true/1/on/yes OR false/0/off/no ]", ex.getMessage()); } } { Settings settings = Settings.builder().put("tribe.blocks.wtf", "BOOM").build(); try { new SettingsModule(settings); fail(); } catch (IllegalArgumentException ex) { assertEquals( "tribe.blocks validation failed: unknown setting [wtf] please check that any required plugins are" + " installed, or check the breaking changes documentation for removed settings", ex.getMessage()); } } }
/** * Reload RecipeManager's settings, messages, etc and re-parse recipes. * * @param sender To whom to send the messages to, null = console. * @param check Set to true to only check recipes, settings are unaffected. */ public void reload(CommandSender sender, boolean check, boolean firstTime) { Settings.getInstance().reload(sender); // (re)load settings Messages.getInstance().reload(sender); // (re)load messages from messages.yml Files.reload(sender); // (re)generate info files if they do not exist Updater.init(this, 32835, null); if (metrics == null) { if (Settings.getInstance().getMetrics()) { // start/stop metrics accordingly try { metrics = new Metrics(this); metrics.start(); } catch (IOException e) { e.printStackTrace(); } } } else { metrics.stop(); } if (!check) { if (Settings.getInstance().getClearRecipes() || !firstTime) { Vanilla.removeAllButSpecialRecipes(); Recipes.getInstance().clean(); } if (!firstTime && !Settings.getInstance().getClearRecipes()) { Vanilla.restoreAllButSpecialRecipes(); Recipes.getInstance().index.putAll(Vanilla.initialRecipes); } } RecipeProcessor.reload(sender, check); // (re)parse recipe files Events.reload(); // (re)register events }
private void initSettings() { settings = Settings.get(this); if (TextUtils.isEmpty(settings.getMmsc())) { initApns(); } }
private void configureUI() { // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setUseNarrowButtons(settings.isUseNarrowButtons()); Options.setTabIconsEnabled(settings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled()); // Swing Settings LookAndFeel selectedLaf = settings.getSelectedLookAndFeel(); // Work around caching in MetalRadioButtonUI JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio); JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); try { UIManager.setLookAndFeel(selectedLaf); SwingUtilities.updateComponentTreeUI(this); } catch (UnsupportedLookAndFeelException uslafe) { System.out.println("UnsupportedLookAndFeelException: " + uslafe.getMessage()); } catch (Exception e) { System.out.println("Can't change L&F: " + e); } // // FensterIcon // String IconLocation = ResourceManager.getString("icon.IconImage"); // System.out.println("[i] set IconImage: " + // getClass().getResource(IconLocation).toString()); // setIconImage( new // ImageIcon(getClass().getResource(IconLocation)).getImage()); }
public static void destroy() { if (sInstance == null) { throw new RuntimeException("No instance to destroy"); } Settings.get().saveData(); MainApplication app = (MainApplication) sInstance.mContext.getApplicationContext(); Bus bus = app.getBus(); bus.unregister(sInstance); if (Settings.get().isIncognitoMode()) { CookieManager cookieManager = CookieManager.getInstance(); if (cookieManager != null && cookieManager.hasCookies()) { cookieManager.removeAllCookie(); } } if (Constant.PROFILE_FPS) { sInstance.mWindowManager.removeView(sInstance.mTextView); } sInstance.mBubbleDraggable.destroy(); sInstance.mBubbleFlowDraggable.destroy(); sInstance.mCanvasView.destroy(); sInstance.mChoreographer.removeFrameCallback(sInstance); sInstance.endAppPolling(); sInstance = null; }
public Cyborg() { if (instance != null) { throw new IllegalAccessError("There is already an instance of Cyborg!"); } pluginManager = new CommonPluginManager(this); pluginManager.registerPluginLoader(CommonPluginLoader.class); eventManager = new SimpleEventManager(); commandManager = new CommonCommandManager(); // Register Internal Listeners bot.getListenerManager().addListener(new PircBotXListener()); eventManager.registerEvents(new CommandListener(), this); eventManager.registerEvents(new InternalListener(), this); // Setup Bot \\ bot.setVerbose(StartupArguments.getInstance().isVerbose()); bot.setName(Settings.getNick()); bot.setLogin(Settings.getIdent()); setMessageDelay(Settings.getMessageDelay()); // Register Default Commands \\ commandManager.registerCommands( new Named() { @Override public String getName() { return Cyborg.class.getCanonicalName(); } }, TerminalCommands.class, new EmptyConstructorInjector()); instance = this; }
/** * @return String from the page * @throws Exception */ private static String GetPHRAZE() throws Exception { String PHRAZE = ""; try { URLConnection connection = new java.net.URL(Settings.GET_PANEL_URL() + "?key=" + Settings.GET_PANEL_KEYPHRAZE()) .openConnection(); InputStream ist = connection.getInputStream(); InputStreamReader reader = new InputStreamReader(ist); char[] buffer = new char[256]; int rc; StringBuilder sb = new StringBuilder(); while ((rc = reader.read(buffer)) != -1) sb.append(buffer, 0, rc); reader.close(); PHRAZE = String.valueOf(sb); } catch (Exception e) { PRINT("ERROR: " + e.toString() + " [Methods::OpenURL]", 1); // Thread.currentThread().stop(); Thread.currentThread().interrupt(); return ""; } if (Settings.GET_DO_ONLY_ONCE()) { if (Objects.equals(PHRAZE, PREVIOUS_PHRAZE)) { Thread.currentThread().interrupt(); return ""; } else { PREVIOUS_PHRAZE = PHRAZE; } } return PHRAZE; }
private void updateRunning(float deltaTime) { List<TouchEvent> touchEvents = game.getInput().getTouchEvents(); int len = touchEvents.size(); for (int i = 0; i < len; i++) { TouchEvent event = touchEvents.get(i); if (event.type != TouchEvent.TOUCH_UP) continue; touchPoint.set(event.x, event.y); guiCam.touchToWorld(touchPoint); if (OverlapTester.pointInRectangle(pauseBounds, touchPoint)) { Assets.playSound(Assets.clickSound); state = GAME_PAUSED; return; } } world.update(deltaTime, game.getInput().getAccelX()); if (world.score != lastScore) { lastScore = world.score; scoreString = "" + lastScore; } if (world.state == World.WORLD_STATE_NEXT_LEVEL) { state = GAME_LEVEL_END; } if (world.state == World.WORLD_STATE_GAME_OVER) { state = GAME_OVER; if (lastScore >= Settings.highscores[4]) scoreString = "new highscore: " + lastScore; else scoreString = "score: " + lastScore; Settings.addScore(lastScore); Settings.save(game.getFileIO()); } }
private void saveProfile() { mSettings.name = mName.getText().toString(); mSettings.school = mSchool.getText().toString(); mSettings.grade = mGrade.getText().toString(); mSettings.group = mGroup.getText().toString(); mSettings.saveSettings(); }
public PushSubscription createPushSubscription( Stream stream, FutureData<PreparedHistoricsQuery> query) throws InterruptedException { S3 s3 = PushConnectors.s3() .accessKey(settings.getS3AccessKey()) .secretKey(settings.getS3SecretKey()) .bucket("apitests") .directory("java-client") .acl("private") .deliveryFrequency(0) .maxSize(10485760) .filePrefix("DataSiftJava-"); PushValidation pv = datasift.push().validate(s3).sync(); successful(pv); String name = "Java push name", updatedName = name += " updated"; PushSubscription subscription = stream != null ? datasift.push().create(s3, stream, name).sync() : datasift.push().create(s3, query, name).sync(); successful(subscription); Assert.assertTrue(subscription.status().isActive()); // test update PushSubscription updatedSubscription = datasift.push().update(subscription.getId(), s3, updatedName).sync(); successful(updatedSubscription); assertEquals(updatedName, updatedSubscription.name()); return subscription; }
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException { out.writeVInt(settings.getAsMap().size()); for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) { out.writeString(entry.getKey()); out.writeString(entry.getValue()); } }
public void wdgmsg(Widget sender, String msg, Object... args) { if (sender == this && msg.equals("close")) { Settings.setFindTargetName(null); Settings.setCancelAuto(true); t.stop(); } super.wdgmsg(sender, msg, args); }
@Override public Settings buildSettings(ServiceRegistry serviceRegistry) { Settings settings = super.buildSettings(serviceRegistry); settings .getEntityTuplizerFactory() .registerDefaultTuplizerClass(EntityMode.POJO, GroovyAwarePojoEntityTuplizer.class); return settings; }
public static void startServices(Context context) { Settings settings = Settings.getInstance(context); int interval = getIntervalTime(settings.getInt(Settings.NOTIFICATION_INTERVAL, 1)); if (interval > -1) { startServiceAlarm(context, ReminderService.class, interval); } }
@Override public boolean hasChanged(Settings current, Settings previous) { return current .filter(loggerPredicate) .getAsMap() .equals(previous.filter(loggerPredicate).getAsMap()) == false; }