Fix a couple of NPEs caused by /game stop

This commit is contained in:
Sam 2017-11-07 22:18:53 +00:00 committed by Alexander Meech
parent 933d6864e5
commit ed7472f0c4
2 changed files with 21 additions and 1 deletions

View File

@ -30,6 +30,11 @@ public class ExperienceSummaryComponent extends GameSummaryComponent<Pair<Achiev
@Override
public String getMainText(Pair<AchievementLog, AchievementData> data)
{
if (data.getLeft() == null)
{
return null;
}
return C.cGray + "+" + C.cYellow + data.getLeft().Amount + C.cGray + " Experience";
}
@ -37,6 +42,12 @@ public class ExperienceSummaryComponent extends GameSummaryComponent<Pair<Achiev
public List<String> getHoverText(Pair<AchievementLog, AchievementData> data)
{
AchievementData achievementData = data.getRight();
if (achievementData == null)
{
return null;
}
List<String> text = new ArrayList<>(2);
text.add(C.cGray + "You are level " + C.cGreen + achievementData.getLevel());

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.modules.winstreak;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -40,7 +42,14 @@ public class WinStreakModule extends Module
return;
}
getGame().getWinners().forEach(this::incrementStreak);
List<Player> winners = getGame().getWinners();
if (winners == null)
{
return;
}
winners.forEach(this::incrementStreak);
}
@EventHandler(priority = EventPriority.MONITOR)