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; 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.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -277,36 +272,36 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
} catch (final Exception e) {} } catch (final Exception e) {}
} }
if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){ // if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
// Is a new update available? // // Is a new update available?
BufferedReader bufferedReader = null; // BufferedReader bufferedReader = null;
updateAvailable = false; // updateAvailable = false;
try { // try {
final String[] split = getDescription().getVersion().split("-b"); // final String[] split = getDescription().getVersion().split("-b");
final int currentVersion = Integer.parseInt(split[split.length - 1]); // final int currentVersion = Integer.parseInt(split[split.length - 1]);
final URL url = new URL("http://nocheatplus.org:8080/job/NoCheatPlus/lastSuccessfulBuild/api/json"); // final URL url = new URL("http://nocheatplus.org:8080/job/NoCheatPlus/lastSuccessfulBuild/api/json");
final URLConnection connection = url.openConnection(); // final URLConnection connection = url.openConnection();
connection.setReadTimeout(config.getInt(ConfPaths.MISCELLANEOUS_READTIMEOUT, 4) * 1000); // connection.setReadTimeout(config.getInt(ConfPaths.MISCELLANEOUS_READTIMEOUT, 4) * 1000);
bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream())); // bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line, content = ""; // String line, content = "";
while ((line = bufferedReader.readLine()) != null) // while ((line = bufferedReader.readLine()) != null)
content += line; // content += line;
final int jenkinsVersion = Integer.parseInt(content.split("\"number\":")[1].split(",")[0]); // final int jenkinsVersion = Integer.parseInt(content.split("\"number\":")[1].split(",")[0]);
updateAvailable = currentVersion < jenkinsVersion; // updateAvailable = currentVersion < jenkinsVersion;
} catch (final Exception e) {} // } catch (final Exception e) {}
finally{ // finally{
if (bufferedReader != null) try{bufferedReader.close();}catch (IOException e){}; // if (bufferedReader != null) try{bufferedReader.close();}catch (IOException e){};
} // }
} // }
// Is the configuration outdated? // // Is the configuration outdated?
try { // try {
final int currentVersion = Integer.parseInt(getDescription().getVersion().split("-b")[1]); // final int currentVersion = Integer.parseInt(getDescription().getVersion().split("-b")[1]);
final int configurationVersion = Integer.parseInt( // final int configurationVersion = Integer.parseInt(
config.options().header().split("-b")[1].split("\\.")[0]); // config.options().header().split("-b")[1].split("\\.")[0]);
if (currentVersion > configurationVersion) // if (currentVersion > configurationVersion)
configOutdated = true; // configOutdated = true;
} catch (final Exception e) {} // } catch (final Exception e) {}
// Debug information about unknown blocks. // Debug information about unknown blocks.
// (Probably removed later.) // (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_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly"; public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly";
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins"; public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
public static final String MISCELLANEOUS_CHECKFORUPDATES = MISCELLANEOUS + "checkforupdates"; // public static final String MISCELLANEOUS_CHECKFORUPDATES = MISCELLANEOUS + "checkforupdates";
public static final String MISCELLANEOUS_READTIMEOUT = MISCELLANEOUS + "readtimeout"; // public static final String MISCELLANEOUS_READTIMEOUT = MISCELLANEOUS + "readtimeout";
public static final String MISCELLANEOUS_REPORTTOMETRICS = MISCELLANEOUS + "reporttometrics"; public static final String MISCELLANEOUS_REPORTTOMETRICS = MISCELLANEOUS + "reporttometrics";
private static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY = MISCELLANEOUS + "nomovedtooquickly."; private static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY = MISCELLANEOUS + "nomovedtooquickly.";
public static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED = MISCELLANEOUS_NOMOVEDTOOQUICKLY + "enabled"; 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_ALLOWCLIENTMODS, false);
set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false); set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false);
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true); set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
set(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES, true); // set(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES, true);
set(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS, true); set(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS, true);
// set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED, false); // set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED, false);