Remove the updater for now

This commit is contained in:
Dan Mulloy 2014-11-24 11:41:04 -05:00
parent e1e0c4a05a
commit e69832a82a
2 changed files with 197 additions and 199 deletions

View File

@ -62,8 +62,8 @@ class CommandProtocol extends CommandBase {
reloadConfiguration(sender);
else if (subCommand.equalsIgnoreCase("check"))
checkVersion(sender);
else if (subCommand.equalsIgnoreCase("update"))
updateVersion(sender);
// else if (subCommand.equalsIgnoreCase("update"))
// updateVersion(sender);
else if (subCommand.equalsIgnoreCase("timings"))
toggleTimings(sender, args);
else if (subCommand.equalsIgnoreCase("listeners"))

View File

@ -46,9 +46,6 @@ import com.comphenix.protocol.injector.InternalManager;
import com.comphenix.protocol.injector.PacketFilterManager;
import com.comphenix.protocol.injector.PacketFilterManager.PlayerInjectHooks;
import com.comphenix.protocol.metrics.Statistics;
import com.comphenix.protocol.metrics.Updater;
import com.comphenix.protocol.metrics.Updater.UpdateResult;
import com.comphenix.protocol.metrics.Updater.UpdateType;
import com.comphenix.protocol.reflect.compiler.BackgroundCompiler;
import com.comphenix.protocol.utility.ChatExtensions;
import com.comphenix.protocol.utility.EnhancerFactory;
@ -90,7 +87,7 @@ public class ProtocolLibrary extends JavaPlugin {
/**
* The maximum version ProtocolLib has been tested with,
*/
public static final String MAXIMUM_MINECRAFT_VERSION = "1.7.4";
public static final String MAXIMUM_MINECRAFT_VERSION = "1.7.10";
/**
* The date (with ISO 8601 or YYYY-MM-DD) when the most recent version was released.
@ -98,8 +95,8 @@ public class ProtocolLibrary extends JavaPlugin {
public static final String MINECRAFT_LAST_RELEASE_DATE = "2013-12-10";
// Update information
static final String BUKKIT_DEV_SLUG = "protocollib";
static final int BUKKIT_DEV_ID = 45564;
// static final String BUKKIT_DEV_SLUG = "protocollib";
// static final int BUKKIT_DEV_ID = 45564;
// Different commands
private enum ProtocolCommand {
@ -124,8 +121,8 @@ public class ProtocolLibrary extends JavaPlugin {
// Strongly typed configuration
private static ProtocolConfig config;
// Metrics and statistisc
private Statistics statistisc;
// Metrics and statistics
private Statistics statistics;
// Executors
private static ListeningScheduledExecutorService executorAsync;
@ -146,13 +143,13 @@ public class ProtocolLibrary extends JavaPlugin {
// Settings/options
private int configExpectedMod = -1;
// Updater
private Updater updater;
private static boolean UPDATES_DISABLED;
// Updater
// private Updater updater;
// private static boolean UPDATES_DISABLED;
// Logger
private Logger logger;
private Handler redirectHandler;
// Logger
private Logger logger;
private Handler redirectHandler;
// Commands
private CommandProtocol commandProtocol;
@ -209,8 +206,9 @@ public class ProtocolLibrary extends JavaPlugin {
// Handle unexpected Minecraft versions
MinecraftVersion version = verifyMinecraftVersion();
// TODO: Redo the update mechanism for Spigot?
// Set updater - this will not perform any update automatically
updater = new Updater(this, BUKKIT_DEV_ID, getFile(), UpdateType.NO_DOWNLOAD, true);
// updater = new Updater(this, BUKKIT_DEV_ID, getFile(), UpdateType.NO_DOWNLOAD, true);
unhookTask = new DelayedSingleTask(this);
protocolManager = PacketFilterManager.newBuilder().
@ -261,7 +259,7 @@ public class ProtocolLibrary extends JavaPlugin {
try {
switch (command) {
case PROTOCOL:
commandProtocol = new CommandProtocol(reporter, this, updater, config); break;
commandProtocol = new CommandProtocol(reporter, this, null, config); break;
case FILTER:
commandFilter = new CommandFilter(reporter, this, config); break;
case PACKET:
@ -416,16 +414,16 @@ public class ProtocolLibrary extends JavaPlugin {
// Try to enable statistics
try {
if (config.isMetricsEnabled()) {
statistisc = new Statistics(this);
statistics = new Statistics(this);
}
} catch (OutOfMemoryError e) {
throw e;
} catch (ThreadDeath e) {
throw e;
} catch (IOException e) {
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_IO_ERROR).error(e).callerParam(statistisc));
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_IO_ERROR).error(e).callerParam(statistics));
} catch (Throwable e) {
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_GENERIC_ERROR).error(e).callerParam(statistisc));
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_GENERIC_ERROR).error(e).callerParam(statistics));
}
}
@ -543,18 +541,18 @@ public class ProtocolLibrary extends JavaPlugin {
// We KNOW we're on the main thread at the moment
manager.sendProcessedPackets(tickCounter++, true);
// House keeping
updateConfiguration();
// House keeping
updateConfiguration();
// Check for updates too
if (!UPDATES_DISABLED && (tickCounter % 20) == 0) {
checkUpdates();
}
}
}, ASYNC_MANAGER_DELAY, ASYNC_MANAGER_DELAY);
// Check for updates too
// if (!UPDATES_DISABLED && (tickCounter % 20) == 0) {
// checkUpdates();
// }
}
}, ASYNC_MANAGER_DELAY, ASYNC_MANAGER_DELAY);
} catch (OutOfMemoryError e) {
throw e;
} catch (OutOfMemoryError e) {
throw e;
} catch (ThreadDeath e) {
throw e;
} catch (Throwable e) {
@ -573,28 +571,28 @@ public class ProtocolLibrary extends JavaPlugin {
}
}
private void checkUpdates() {
// Ignore milliseconds - it's pointless
long currentTime = System.currentTimeMillis() / MILLI_PER_SECOND;
try {
long updateTime = config.getAutoLastTime() + config.getAutoDelay();
// Should we update?
if (currentTime > updateTime && !updater.isChecking()) {
// Initiate the update as if it came from the console
if (config.isAutoDownload())
commandProtocol.updateVersion(getServer().getConsoleSender());
else if (config.isAutoNotify())
commandProtocol.checkVersion(getServer().getConsoleSender());
else
commandProtocol.updateFinished();
}
} catch (Exception e) {
reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLUGIN).error(e));
UPDATES_DISABLED = true;
}
}
// private void checkUpdates() {
// // Ignore milliseconds - it's pointless
// long currentTime = System.currentTimeMillis() / MILLI_PER_SECOND;
//
// try {
// long updateTime = config.getAutoLastTime() + config.getAutoDelay();
//
// // Should we update?
// if (currentTime > updateTime && !updater.isChecking()) {
// // Initiate the update as if it came from the console
// if (config.isAutoDownload())
// commandProtocol.updateVersion(getServer().getConsoleSender());
// else if (config.isAutoNotify())
// commandProtocol.checkVersion(getServer().getConsoleSender());
// else
// commandProtocol.updateFinished();
// }
// } catch (Exception e) {
// reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLUGIN).error(e));
// UPDATES_DISABLED = true;
// }
// }
@Override
public void onDisable() {
@ -630,16 +628,16 @@ public class ProtocolLibrary extends JavaPlugin {
if (unhookTask != null)
unhookTask.close();
protocolManager = null;
statistisc = null;
statistics = null;
// To clean up global parameters
reporter = new BasicErrorReporter();
// Leaky ClassLoader begone!
if (updater == null || updater.getResult() != UpdateResult.SUCCESS) {
CleanupStaticMembers cleanup = new CleanupStaticMembers(getClassLoader(), reporter);
cleanup.resetAll();
}
// if (updater == null || updater.getResult() != UpdateResult.SUCCESS) {
// CleanupStaticMembers cleanup = new CleanupStaticMembers(getClassLoader(), reporter);
// cleanup.resetAll();
// }
}
// Get the Bukkit logger first, before we try to create our own
@ -696,7 +694,7 @@ public class ProtocolLibrary extends JavaPlugin {
* @return Metrics instance container.
*/
public Statistics getStatistics() {
return statistisc;
return statistics;
}
/**