Fix some memory leaks within Nano Games

This commit is contained in:
Sam 2018-09-20 23:46:43 +01:00 committed by Alexander Meech
parent bef370c077
commit aee9b2986c
3 changed files with 8 additions and 6 deletions

View File

@ -138,7 +138,7 @@ public class GameCurrencyManager extends GameManager implements CurrencyComponen
private void informRewards(Player player, boolean reward)
{
GameSessionData data = _sessionData.get(player);
GameSessionData data = reward ? _sessionData.remove(player) : _sessionData.get(player);
if (data == null || data.Games == 0)
{
@ -202,9 +202,6 @@ public class GameCurrencyManager extends GameManager implements CurrencyComponen
statsManager.incrementStat(player, "Global.GamesPlayed", gamesPlayed);
require(TrackManager.class).getTrack(GemCollectorTrack.class).earnedGems(player, gems);
}
// Remove from session
_sessionData.remove(player);
}
// Inform

View File

@ -78,7 +78,7 @@ public class ChallengePunchAPig extends Challenge
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(false);
if (damagee instanceof Pig)
if (damagee instanceof Pig && damager != null)
{
int punched = _punched.getOrDefault(damager, 0) + 1;

View File

@ -49,8 +49,13 @@ public class ChallengeReverseRunner extends Challenge
return;
}
for (Player player : _players)
for (Player player : _game.getAlivePlayers())
{
if (!isParticipating(player))
{
continue;
}
Location location = player.getLocation().add(0, 10, 0).getBlock().getLocation().add(0.5, 0, 0.5);
if (!inArena(location))