mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-11 19:02:16 +01:00
Fixed NPE on manage remove command if player was not online (Remove was still successful)
This commit is contained in:
parent
9447bb812b
commit
4784d6f035
@ -93,9 +93,10 @@ public class ManageRemoveCommand extends SubCommand {
|
||||
|
||||
DataCache dataCache = plugin.getDataCache();
|
||||
Player player = getPlayer(uuid);
|
||||
dataCache.getActiveSessions().remove(uuid);
|
||||
dataCache.cacheSession(uuid, new Session(MiscUtils.getTime(), player.getWorld().getName(), player.getGameMode().name()));
|
||||
|
||||
if (player != null) {
|
||||
dataCache.getActiveSessions().remove(uuid);
|
||||
dataCache.cacheSession(uuid, new Session(MiscUtils.getTime(), player.getWorld().getName(), player.getGameMode().name()));
|
||||
}
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_REMOVE_SUCCESS).parse(playerName, plugin.getDB().getConfigName()));
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
|
@ -34,12 +34,12 @@ public class SessionCache {
|
||||
}
|
||||
|
||||
public void endSession(UUID uuid, long time) {
|
||||
Session session = activeSessions.get(uuid);
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
session.endSession(time);
|
||||
try {
|
||||
Session session = activeSessions.get(uuid);
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
session.endSession(time);
|
||||
plugin.getDB().getSessionsTable().saveSession(uuid, session);
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
|
Loading…
Reference in New Issue
Block a user