don't access ConsoleCommandSender until after processes start running,

also fix if permissions get altered while server is running.
This commit is contained in:
Nick Minkler 2013-12-24 13:19:03 -08:00
parent 89dd252bf4
commit a64a341a35

View File

@ -132,13 +132,13 @@ public class Vault extends JavaPlugin {
getCommand("vault-info").setExecutor(this); getCommand("vault-info").setExecutor(this);
getCommand("vault-convert").setExecutor(this); getCommand("vault-convert").setExecutor(this);
getServer().getPluginManager().registerEvents(new VaultListener(), this); getServer().getPluginManager().registerEvents(new VaultListener(), this);
if (getServer().getConsoleSender().hasPermission("vault.update")) { // Schedule to check the version every 30 minutes for an update. This is to update the most recent
// Schedule to check the version every 30 minutes for an update. This is to update the most recent // version so if an admin reconnects they will be warned about newer versions.
// version so if an admin reconnects they will be warned about newer versions. this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
@Override @Override
public void run() { public void run() {
if (getServer().getConsoleSender().hasPermission("vault.update")) {
try { try {
newVersion = updateCheck(currentVersion); newVersion = updateCheck(currentVersion);
log.info("Vault version from web: " + newVersion); log.info("Vault version from web: " + newVersion);
@ -154,9 +154,10 @@ public class Vault extends JavaPlugin {
// ignore exceptions // ignore exceptions
} }
} }
}
}, 0, 432000);
}, 0, 432000);
}
// Load up the Plugin metrics // Load up the Plugin metrics
try { try {
metrics = new Metrics(this); metrics = new Metrics(this);