mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-26 01:51:20 +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();
|
DataCache dataCache = plugin.getDataCache();
|
||||||
Player player = getPlayer(uuid);
|
Player player = getPlayer(uuid);
|
||||||
dataCache.getActiveSessions().remove(uuid);
|
if (player != null) {
|
||||||
dataCache.cacheSession(uuid, new Session(MiscUtils.getTime(), player.getWorld().getName(), player.getGameMode().name()));
|
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()));
|
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_REMOVE_SUCCESS).parse(playerName, plugin.getDB().getConfigName()));
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Log.toLog(this.getClass().getName(), e);
|
Log.toLog(this.getClass().getName(), e);
|
||||||
|
@ -34,12 +34,12 @@ public class SessionCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void endSession(UUID uuid, long time) {
|
public void endSession(UUID uuid, long time) {
|
||||||
Session session = activeSessions.get(uuid);
|
|
||||||
if (session == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
session.endSession(time);
|
|
||||||
try {
|
try {
|
||||||
|
Session session = activeSessions.get(uuid);
|
||||||
|
if (session == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
session.endSession(time);
|
||||||
plugin.getDB().getSessionsTable().saveSession(uuid, session);
|
plugin.getDB().getSessionsTable().saveSession(uuid, session);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Log.toLog(this.getClass().getName(), e);
|
Log.toLog(this.getClass().getName(), e);
|
||||||
|
Loading…
Reference in New Issue
Block a user