mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Trycatch updates incase of connection failure. Fixes #84. @h31ix, Fix this if you don't like it.
This commit is contained in:
1 parent
56beda4baf
commit
137d968a70
1 file changed
+49
-42
@@ -282,70 +282,77 @@ public class Anticheat extends JavaPlugin
|
||||
{
|
||||
logger.log(Level.INFO, "Checking for updates...");
|
||||
}
|
||||
URL url;
|
||||
URLConnection urlConn;
|
||||
InputStreamReader inStream = null;
|
||||
BufferedReader buff;
|
||||
String v = "";
|
||||
try
|
||||
{
|
||||
url = new URL("http://dl.dropbox.com/u/38228324/anticheatVersion.txt");
|
||||
urlConn = url.openConnection();
|
||||
inStream = new InputStreamReader(urlConn.getInputStream());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
buff = new BufferedReader(inStream);
|
||||
try
|
||||
{
|
||||
v = buff.readLine();
|
||||
urlConn = null;
|
||||
inStream = null;
|
||||
buff.close();
|
||||
buff = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
String version = this.getDescription().getVersion().split("-b")[0];
|
||||
if (!version.equalsIgnoreCase(v))
|
||||
{
|
||||
if (version.endsWith("-PRE") || version.endsWith("-DEV"))
|
||||
URL url;
|
||||
URLConnection urlConn;
|
||||
InputStreamReader inStream = null;
|
||||
BufferedReader buff;
|
||||
String v = "";
|
||||
try
|
||||
{
|
||||
if (version.replaceAll("-PRE", "").replaceAll("-DEV", "").equalsIgnoreCase(v))
|
||||
url = new URL("http://dl.dropbox.com/u/38228324/anticheatVersion.txt");
|
||||
urlConn = url.openConnection();
|
||||
inStream = new InputStreamReader(urlConn.getInputStream());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
buff = new BufferedReader(inStream);
|
||||
try
|
||||
{
|
||||
v = buff.readLine();
|
||||
urlConn = null;
|
||||
inStream = null;
|
||||
buff.close();
|
||||
buff = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
String version = this.getDescription().getVersion().split("-b")[0];
|
||||
if (!version.equalsIgnoreCase(v))
|
||||
{
|
||||
if (version.endsWith("-PRE") || version.endsWith("-DEV"))
|
||||
{
|
||||
update = true;
|
||||
if (verbose)
|
||||
if (version.replaceAll("-PRE", "").replaceAll("-DEV", "").equalsIgnoreCase(v))
|
||||
{
|
||||
logger.log(Level.INFO, "Your dev build has been promoted to release. Downloading the update.");
|
||||
update = true;
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "Your dev build has been promoted to release. Downloading the update.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update = false;
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "Dev build detected, so skipping update checking until this version is released.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update = false;
|
||||
update = true;
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "Dev build detected, so skipping update checking until this version is released.");
|
||||
logger.log(Level.INFO, "An update was found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update = true;
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "An update was found.");
|
||||
logger.log(Level.INFO, "No update found.");
|
||||
}
|
||||
update = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "No update found.");
|
||||
}
|
||||
update = false;
|
||||
logger.log(Level.SEVERE, "Updating failed. Possible connection failure.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user