Archiviert
13
0

Remove the updater for now

Dieser Commit ist enthalten in:
Dan Mulloy 2014-11-24 11:41:04 -05:00
Ursprung e1e0c4a05a
Commit e69832a82a
2 geänderte Dateien mit 197 neuen und 199 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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