From f7e56d983346e4aeed7ea187b655cfe0e7597f1f Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Thu, 10 Jan 2013 20:49:33 -0500 Subject: [PATCH] (Hopefully) Fix NPE, delay PurgeTask start for a few seconds just to be safe. --- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- src/main/java/com/gmail/nossr50/runnables/UserPurgeTask.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 98214013f..4527f2569 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -201,7 +201,7 @@ public class mcMMO extends JavaPlugin { //Old & Powerless User remover int purgeInterval = Config.getInstance().getPurgeInterval(); if (purgeInterval == 0) { - scheduler.runTask(this, new UserPurgeTask(this)); + scheduler.scheduleSyncDelayedTask(this, new UserPurgeTask(this), 40); //Start 2 seconds after startup. } else if (purgeInterval > 0) { scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(this), 0, purgeInterval * 60L * 60L * 20L); diff --git a/src/main/java/com/gmail/nossr50/runnables/UserPurgeTask.java b/src/main/java/com/gmail/nossr50/runnables/UserPurgeTask.java index f4e4cd5d3..75ebfea3d 100644 --- a/src/main/java/com/gmail/nossr50/runnables/UserPurgeTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/UserPurgeTask.java @@ -41,7 +41,7 @@ public class UserPurgeTask implements Runnable { int userId = Integer.valueOf(userslist.get(i).get(1)); HashMap> username = database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + userId + "'"); - if (Bukkit.getPlayer(username.get(1).get(0)).isOnline()) { + if (username != null && Bukkit.getOfflinePlayer(username.get(1).get(0)).isOnline()) { continue; }