Skip to content

Commit

Permalink
Added failsafe to waiting.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainStone committed Jun 15, 2017
1 parent e8094c3 commit ee078ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/world/jnc/invsync/event/PlayerEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public WaitingForPreviousServerToFinish(Player player, int maxWait) {
@Override
public void accept(Task task) {
boolean timeOk = endTime > System.currentTimeMillis();
UUID uuid = player.getUniqueId();

if (dataSource.isActive(player) && timeOk)
return;
Expand All @@ -187,13 +188,19 @@ public void accept(Task task) {
}

synchronized (waitingPlayers) {
waitingPlayers.remove(player.getUniqueId());
waitingPlayers.remove(uuid);
}

loadPlayer(player);
} catch (ClassNotFoundException | IOException | DataFormatException e) {
InventorySync.getLogger().warn("Loading player " + DataSource.getPlayerString(player) + " failed!", e);
} finally {
synchronized (waitingPlayers) {
if (waitingPlayers.containsKey(uuid)) {
waitingPlayers.remove(uuid);
}
}

task.cancel();
}
}
Expand Down

0 comments on commit ee078ed

Please sign in to comment.