Remove checkforupdates for the moment.

This commit is contained in:
asofold 2012-09-17 00:06:59 +02:00
parent 3348400268
commit 82502ca7cd
3 changed files with 32 additions and 37 deletions

View File

@ -1,10 +1,5 @@
package fr.neatmonster.nocheatplus;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -277,36 +272,36 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
} catch (final Exception e) {}
}
if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
// Is a new update available?
BufferedReader bufferedReader = null;
updateAvailable = false;
try {
final String[] split = getDescription().getVersion().split("-b");
final int currentVersion = Integer.parseInt(split[split.length - 1]);
final URL url = new URL("http://nocheatplus.org:8080/job/NoCheatPlus/lastSuccessfulBuild/api/json");
final URLConnection connection = url.openConnection();
connection.setReadTimeout(config.getInt(ConfPaths.MISCELLANEOUS_READTIMEOUT, 4) * 1000);
bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line, content = "";
while ((line = bufferedReader.readLine()) != null)
content += line;
final int jenkinsVersion = Integer.parseInt(content.split("\"number\":")[1].split(",")[0]);
updateAvailable = currentVersion < jenkinsVersion;
} catch (final Exception e) {}
finally{
if (bufferedReader != null) try{bufferedReader.close();}catch (IOException e){};
}
}
// if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
// // Is a new update available?
// BufferedReader bufferedReader = null;
// updateAvailable = false;
// try {
// final String[] split = getDescription().getVersion().split("-b");
// final int currentVersion = Integer.parseInt(split[split.length - 1]);
// final URL url = new URL("http://nocheatplus.org:8080/job/NoCheatPlus/lastSuccessfulBuild/api/json");
// final URLConnection connection = url.openConnection();
// connection.setReadTimeout(config.getInt(ConfPaths.MISCELLANEOUS_READTIMEOUT, 4) * 1000);
// bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
// String line, content = "";
// while ((line = bufferedReader.readLine()) != null)
// content += line;
// final int jenkinsVersion = Integer.parseInt(content.split("\"number\":")[1].split(",")[0]);
// updateAvailable = currentVersion < jenkinsVersion;
// } catch (final Exception e) {}
// finally{
// if (bufferedReader != null) try{bufferedReader.close();}catch (IOException e){};
// }
// }
// Is the configuration outdated?
try {
final int currentVersion = Integer.parseInt(getDescription().getVersion().split("-b")[1]);
final int configurationVersion = Integer.parseInt(
config.options().header().split("-b")[1].split("\\.")[0]);
if (currentVersion > configurationVersion)
configOutdated = true;
} catch (final Exception e) {}
// // Is the configuration outdated?
// try {
// final int currentVersion = Integer.parseInt(getDescription().getVersion().split("-b")[1]);
// final int configurationVersion = Integer.parseInt(
// config.options().header().split("-b")[1].split("\\.")[0]);
// if (currentVersion > configurationVersion)
// configOutdated = true;
// } catch (final Exception e) {}
// Debug information about unknown blocks.
// (Probably removed later.)

View File

@ -44,8 +44,8 @@ public abstract class ConfPaths {
public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly";
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
public static final String MISCELLANEOUS_CHECKFORUPDATES = MISCELLANEOUS + "checkforupdates";
public static final String MISCELLANEOUS_READTIMEOUT = MISCELLANEOUS + "readtimeout";
// public static final String MISCELLANEOUS_CHECKFORUPDATES = MISCELLANEOUS + "checkforupdates";
// public static final String MISCELLANEOUS_READTIMEOUT = MISCELLANEOUS + "readtimeout";
public static final String MISCELLANEOUS_REPORTTOMETRICS = MISCELLANEOUS + "reporttometrics";
private static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY = MISCELLANEOUS + "nomovedtooquickly.";
public static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED = MISCELLANEOUS_NOMOVEDTOOQUICKLY + "enabled";

View File

@ -52,7 +52,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false);
set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false);
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
set(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES, true);
// set(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES, true);
set(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS, true);
// set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED, false);