mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-28 12:47:36 +00:00
Fix ArrayIndexOutOfBounds when a newly added admin leaves the game
This commit is contained in:
parent
ac704614c0
commit
08c8393abc
@ -66,8 +66,13 @@ public class ActivityLogEntry implements IConfig
|
||||
|
||||
public void addLogin()
|
||||
{
|
||||
Date currentTime = Date.from(Instant.now());
|
||||
timestamps.add("Login: " + FUtil.dateToString(currentTime));
|
||||
this.addLogin(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void addLogin(final long timestamp)
|
||||
{
|
||||
Date time = Date.from(Instant.ofEpochMilli(timestamp));
|
||||
timestamps.add("Login: " + FUtil.dateToString(time));
|
||||
}
|
||||
|
||||
public void addLogout()
|
||||
|
@ -194,6 +194,15 @@ public class AdminList extends FreedomService
|
||||
// Save admin
|
||||
plugin.sql.addAdmin(admin);
|
||||
|
||||
// Add login time
|
||||
UUID uuid = admin.getUuid();
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
plugin.acl.getActivityLog(player).addLogin(player.getLastLogin());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user