mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-06 16:50:39 +00:00
Another code reformat
This commit is contained in:
@@ -6,16 +6,14 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The core of parabot
|
* The core of parabot
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Core {
|
public class Core {
|
||||||
|
|
||||||
private static boolean debug = false;
|
private static boolean debug = false;
|
||||||
private static boolean verbose = false;
|
private static boolean verbose = false;
|
||||||
private static boolean loadLocal = false; //Loads both local and public scripts/servers
|
private static boolean loadLocal = false; //Loads both local and public scripts/servers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,71 +33,70 @@ public class Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enabled debug mode
|
* Enabled debug mode
|
||||||
*
|
*
|
||||||
* @param debug
|
* @param debug
|
||||||
*/
|
*/
|
||||||
public static void setDebug(final boolean debug) {
|
public static void setDebug(final boolean debug) {
|
||||||
Core.debug = debug;
|
Core.debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the client is in debug mode.
|
* @return if the client is in debug mode.
|
||||||
*/
|
*/
|
||||||
public static boolean inDebugMode() {
|
public static boolean inDebugMode() {
|
||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the client is in verbose mode.
|
* @return if the client is in verbose mode.
|
||||||
*/
|
*/
|
||||||
public static boolean inVerboseMode() {
|
public static boolean inVerboseMode() {
|
||||||
return verbose;
|
return verbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets verbose mode
|
* Sets verbose mode
|
||||||
*
|
*
|
||||||
* @param verbose
|
* @param verbose - enabled
|
||||||
* - enabled
|
*/
|
||||||
*/
|
public static void setVerbose(final boolean verbose) {
|
||||||
public static void setVerbose(final boolean verbose) {
|
Core.verbose = verbose;
|
||||||
Core.verbose = verbose;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void verbose(final String line) {
|
public static void verbose(final String line) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for updates.
|
* Checks for updates.
|
||||||
*
|
*
|
||||||
* @return <b>true</b> if no update is required, otherwise <b>false</b>.
|
* @return <b>true</b> if no update is required, otherwise <b>false</b>.
|
||||||
*/
|
*/
|
||||||
public static boolean isValid() {
|
public static boolean isValid() {
|
||||||
Core.verbose("Checking for updates...");
|
Core.verbose("Checking for updates...");
|
||||||
BufferedReader br = WebUtil.getReader(Configuration.GET_BOT_VERSION);
|
BufferedReader br = WebUtil.getReader(Configuration.GET_BOT_VERSION);
|
||||||
try {
|
try {
|
||||||
double version = Double.parseDouble(br.readLine());
|
double version = Double.parseDouble(br.readLine());
|
||||||
if (Configuration.BOT_VERSION >= version) {
|
if (Configuration.BOT_VERSION >= version) {
|
||||||
Core.verbose("No updates available.");
|
Core.verbose("No updates available.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
br.close();
|
br.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Core.verbose("Updates available...");
|
Core.verbose("Updates available...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user