Archiviert
13
0

Cut down on static calls to the main class

Dieser Commit ist enthalten in:
Dan Mulloy 2016-01-29 23:41:26 -05:00
Ursprung de8bb2bd66
Commit 7630007833
8 geänderte Dateien mit 11 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -256,7 +256,7 @@ class CommandProtocol extends CommandBase {
sender.sendMessage("Data dump written to " + file.getAbsolutePath()); sender.sendMessage("Data dump written to " + file.getAbsolutePath());
} catch (IOException ex) { } catch (IOException ex) {
ProtocolLibrary.getStaticLogger().log(Level.SEVERE, "Failed to create dump:", ex); ProtocolLibrary.log(Level.SEVERE, "Failed to create dump:", ex);
sender.sendMessage(ChatColor.RED + "Failed to create dump! Check console!"); sender.sendMessage(ChatColor.RED + "Failed to create dump! Check console!");
} finally { } finally {
closer.close(); closer.close();

Datei anzeigen

@ -170,7 +170,7 @@ public class ProtocolConfig {
loadingSections = false; loadingSections = false;
// Inform the user // Inform the user
ProtocolLibrary.log("Created default configuration."); plugin.getLogger().info("Created default configuration.");
} }
} }

Datei anzeigen

@ -751,11 +751,11 @@ public class ProtocolLibrary extends JavaPlugin {
log(Level.INFO, message, args); log(Level.INFO, message, args);
} }
public static Logger getStaticLogger() { public static void log(Level level, String message, Throwable ex) {
return logger; logger.log(level, message, ex);
} }
public static void disableUpdates() { public void disableUpdates() {
UPDATES_DISABLED = true; UPDATES_DISABLED = true;
} }
} }

Datei anzeigen

@ -437,8 +437,7 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
return false; return false;
} }
} else { } else {
ProtocolLibrary.log(Level.INFO, "Could not determine asynchronous state of packets."); ProtocolLibrary.log(Level.INFO, "Could not determine asynchronous state of packets (this can probably be ignored)");
ProtocolLibrary.log(Level.INFO, "This can probably be ignored.");
alwaysSync = true; alwaysSync = true;
} }
} }

Datei anzeigen

@ -40,7 +40,7 @@ public class Guava {
Class<?> clazz = Class.forName("com.comphenix.protocol.compat.guava.Guava10"); Class<?> clazz = Class.forName("com.comphenix.protocol.compat.guava.Guava10");
compat = (GuavaCompat) clazz.newInstance(); compat = (GuavaCompat) clazz.newInstance();
} catch (Throwable ex1) { } catch (Throwable ex1) {
ProtocolLibrary.getStaticLogger().log(Level.SEVERE, "Failed to create Guava 10 compat:", ex1); ProtocolLibrary.log(Level.SEVERE, "Failed to create Guava 10 compat:", ex1);
} }
} }
} }

Datei anzeigen

@ -44,7 +44,7 @@ public class Netty {
Class<?> clazz = Class.forName("com.comphenix.protocol.compat.netty.shaded.ShadedNetty"); Class<?> clazz = Class.forName("com.comphenix.protocol.compat.netty.shaded.ShadedNetty");
compat = (NettyCompat) clazz.newInstance(); compat = (NettyCompat) clazz.newInstance();
} catch (Exception ex1) { } catch (Exception ex1) {
ProtocolLibrary.getStaticLogger().log(Level.SEVERE, "Failed to create legacy netty compat:", ex1); ProtocolLibrary.log(Level.SEVERE, "Failed to create legacy netty compat:", ex1);
} }
} }
} }

Datei anzeigen

@ -9,7 +9,6 @@ import java.util.logging.Level;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginLoadOrder; import org.bukkit.plugin.PluginLoadOrder;
import com.comphenix.protocol.ProtocolLibrary;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
@ -82,7 +81,7 @@ class PluginVerifier {
throw new IllegalArgumentException("dependency cannot have a load directives."); throw new IllegalArgumentException("dependency cannot have a load directives.");
} catch (LinkageError e) { } catch (LinkageError e) {
// They're probably using an ancient version of Bukkit // They're probably using an ancient version of Bukkit
ProtocolLibrary.log(Level.WARNING, "Failed to determine loadBefore: " + e); dependency.getLogger().log(Level.WARNING, "Failed to determine loadBefore: " + e);
} }
this.dependency = dependency; this.dependency = dependency;

Datei anzeigen

@ -76,7 +76,7 @@ public final class SpigotUpdater extends Updater {
plugin.getLogger().log(Level.WARNING, "Failed to check for updates: " + ex); plugin.getLogger().log(Level.WARNING, "Failed to check for updates: " + ex);
} }
ProtocolLibrary.disableUpdates(); plugin.disableUpdates();
} finally { } finally {
// Invoke the listeners on the main thread // Invoke the listeners on the main thread
for (Runnable listener : listeners) { for (Runnable listener : listeners) {