mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Cut down on static calls to the main class
This commit is contained in:
parent
de8bb2bd66
commit
7630007833
@ -256,7 +256,7 @@ class CommandProtocol extends CommandBase {
|
||||
|
||||
sender.sendMessage("Data dump written to " + file.getAbsolutePath());
|
||||
} 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!");
|
||||
} finally {
|
||||
closer.close();
|
||||
|
@ -170,7 +170,7 @@ public class ProtocolConfig {
|
||||
loadingSections = false;
|
||||
|
||||
// Inform the user
|
||||
ProtocolLibrary.log("Created default configuration.");
|
||||
plugin.getLogger().info("Created default configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,11 +751,11 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
log(Level.INFO, message, args);
|
||||
}
|
||||
|
||||
public static Logger getStaticLogger() {
|
||||
return logger;
|
||||
public static void log(Level level, String message, Throwable ex) {
|
||||
logger.log(level, message, ex);
|
||||
}
|
||||
|
||||
public static void disableUpdates() {
|
||||
public void disableUpdates() {
|
||||
UPDATES_DISABLED = true;
|
||||
}
|
||||
}
|
||||
|
@ -437,13 +437,12 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ProtocolLibrary.log(Level.INFO, "Could not determine asynchronous state of packets.");
|
||||
ProtocolLibrary.log(Level.INFO, "This can probably be ignored.");
|
||||
ProtocolLibrary.log(Level.INFO, "Could not determine asynchronous state of packets (this can probably be ignored)");
|
||||
alwaysSync = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (alwaysSync) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ public class Guava {
|
||||
Class<?> clazz = Class.forName("com.comphenix.protocol.compat.guava.Guava10");
|
||||
compat = (GuavaCompat) clazz.newInstance();
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class Netty {
|
||||
Class<?> clazz = Class.forName("com.comphenix.protocol.compat.netty.shaded.ShadedNetty");
|
||||
compat = (NettyCompat) clazz.newInstance();
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import java.util.logging.Level;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
@ -82,7 +81,7 @@ class PluginVerifier {
|
||||
throw new IllegalArgumentException("dependency cannot have a load directives.");
|
||||
} catch (LinkageError e) {
|
||||
// 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;
|
||||
|
@ -76,7 +76,7 @@ public final class SpigotUpdater extends Updater {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to check for updates: " + ex);
|
||||
}
|
||||
|
||||
ProtocolLibrary.disableUpdates();
|
||||
plugin.disableUpdates();
|
||||
} finally {
|
||||
// Invoke the listeners on the main thread
|
||||
for (Runnable listener : listeners) {
|
||||
|
Loading…
Reference in New Issue
Block a user