mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-24 00:51:37 +01:00
Nullcheck user iteration in EssentialsTimer (fixes #675)
This commit is contained in:
parent
dabcb51034
commit
5cbcd7469b
@ -9,9 +9,9 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class EssentialsTimer implements Runnable {
|
public class EssentialsTimer implements Runnable {
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient Set<UUID> onlineUsers = new HashSet<UUID>();
|
private final transient Set<UUID> onlineUsers = new HashSet<>(); // Field is necessary for hidden users
|
||||||
private transient long lastPoll = System.nanoTime();
|
private transient long lastPoll = System.nanoTime();
|
||||||
private final LinkedList<Double> history = new LinkedList<Double>();
|
private final LinkedList<Double> history = new LinkedList<>();
|
||||||
private int skip1 = 0;
|
private int skip1 = 0;
|
||||||
private int skip2 = 0;
|
private int skip2 = 0;
|
||||||
private final long maxTime = 10 * 1000000;
|
private final long maxTime = 10 * 1000000;
|
||||||
@ -76,6 +76,11 @@ public class EssentialsTimer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final User user = ess.getUser(iterator.next());
|
final User user = ess.getUser(iterator.next());
|
||||||
|
// Not sure why this would happen, but it does
|
||||||
|
if (user == null) {
|
||||||
|
iterator.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) {
|
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) {
|
||||||
if (!user.isHidden()) {
|
if (!user.isHidden()) {
|
||||||
user.setLastLogout(user.getLastOnlineActivity());
|
user.setLastLogout(user.getLastOnlineActivity());
|
||||||
|
Loading…
Reference in New Issue
Block a user