mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-06 16:50:39 +00:00
Merge branch 'development' into issue-288/fix-runtime-error
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.parabot;
|
package org.parabot;
|
||||||
|
|
||||||
import org.parabot.api.translations.TranslationHelper;
|
import org.parabot.api.translations.TranslationHelper;
|
||||||
|
import org.parabot.core.Context;
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.Core;
|
||||||
import org.parabot.core.Directories;
|
import org.parabot.core.Directories;
|
||||||
import org.parabot.core.forum.AccountManager;
|
import org.parabot.core.forum.AccountManager;
|
||||||
@@ -9,6 +10,7 @@ import org.parabot.core.network.proxy.ProxySocket;
|
|||||||
import org.parabot.core.network.proxy.ProxyType;
|
import org.parabot.core.network.proxy.ProxyType;
|
||||||
import org.parabot.core.ui.BotUI;
|
import org.parabot.core.ui.BotUI;
|
||||||
import org.parabot.core.ui.ServerSelector;
|
import org.parabot.core.ui.ServerSelector;
|
||||||
|
import org.parabot.core.ui.utils.UILog;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -25,8 +27,14 @@ public final class Landing {
|
|||||||
private static String username;
|
private static String username;
|
||||||
private static String password;
|
private static String password;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
|
|
||||||
|
if (Context.getJavaVersion() >= 9){
|
||||||
|
UILog.log("Parabot", "Parabot doesn't support Java 9+ currently. Please downgrade to Java 8 to ensure Parabot is working correctly.");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
parseArgs(args);
|
parseArgs(args);
|
||||||
|
|
||||||
Directories.validate();
|
Directories.validate();
|
||||||
|
|||||||
@@ -70,6 +70,13 @@ public class Context {
|
|||||||
this.defaultErr = System.err;
|
this.defaultErr = System.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double getJavaVersion() {
|
||||||
|
String version = System.getProperty("java.version");
|
||||||
|
int pos = version.indexOf('.');
|
||||||
|
pos = version.indexOf('.', pos+1);
|
||||||
|
return Double.parseDouble(version.substring (0, pos));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the instance of this class, based on a given ServerProvider
|
* Returns the instance of this class, based on a given ServerProvider
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -105,7 +105,18 @@ public class Timer {
|
|||||||
* @return hourly gains
|
* @return hourly gains
|
||||||
*/
|
*/
|
||||||
public int getPerHour(final int gained) {
|
public int getPerHour(final int gained) {
|
||||||
return (int) ((gained) * 3600000D / (System.currentTimeMillis() - start));
|
return getPerHour(gained, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates hourly gains based on given variable, with variable start amount
|
||||||
|
*
|
||||||
|
* @param gained total gained amount
|
||||||
|
* @param startAmount start amount
|
||||||
|
* @return hourly gains
|
||||||
|
*/
|
||||||
|
public int getPerHour(final int gained, final int startAmount) {
|
||||||
|
return (int) (((gained - startAmount) * 3600000D) / (System.currentTimeMillis() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user