Fix a couple of NPEs caused by /game stop
This commit is contained in:
parent
933d6864e5
commit
ed7472f0c4
@ -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());
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user