Fix issue when users could open challenges gui, even if challenges in that world does not exist (#69)

This commit is contained in:
BONNe 2019-02-05 08:43:58 +02:00
parent ecc7c976c4
commit fa03ea0669

View File

@ -73,6 +73,14 @@ public class ChallengesGUI extends CommonGUI
@Override @Override
public void build() public void build()
{ {
// Do not open gui if there is no challenges.
if (this.challengesManager.getAllChallenges(this.world).isEmpty())
{
this.addon.getLogger().severe("There are no challenges set up!");
this.user.sendMessage("general.errors.general");
return;
}
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.title")); name(this.user.getTranslation("challenges.gui.title"));